Sign up with your email address to be the first to know about new products, VIP offers, blog features & more.

Composer Cheat Sheet

Installing Composer on Unix based OS
$ curl -s https://getcomposer.org/installer | php
$ sudo mv composer.phar /usr/local/bin/composer
Installing Composer on Windows

Access this link: https://getcomposer.org/doc/00-intro.md#installation-windows

Making a composer.json configuration file.

Its important to note that its just normal json file, named composer.json, that is placed in the same folder you will call composer to install packages.

{
    "require": {
        "php": ">=5.5",
        "zendframework/zendframework": "~2.5",
        "doctrine/doctrine-orm-module": "dev-master",
        "doctrine/doctrine-module": "^1.2"
    }
}
To install packages defined in Json configuration file
$ composer install

Fortunately Composer gives us, for free, an Autoloader file.

To start using it just require it and start instantiating you objects!

require_once 'vendor/autoload.php';

$em = new Zend\EventManager\EventManager();
print_r(get_class_methods($em));

No Comments Yet.

What do you think?

Your email address will not be published. Required fields are marked *