Composer for PHP packages

Composer is a great way of installing tools into your app without the old PEAR hassle of installing something on your own laptop, and then having to make sure all the other developers in your team have the same stuff installed. Bah!

So with Composer you just download and install it in your project, and then set up a composer.json dependency file which lists the packages the project needs plus bits of configuration. Something like:

{
“require”: {
“behat/behat”: “2.4@stable”
},
"config": { "bin-dir": "bin/" }
}

Then you just run the composer install script:

php composer.phar install

and it will download and install the relevant stuff into your project’s /vendor folder.

That’s it.

If you want a list of packages that are supported by composer then take a look at packagist

Leave a Reply

Your email address will not be published.