Composer, a package manager for PHP

Composer is probably a bad name for a package manager in the sense where it is hard to research online by searching on the keyword ‘composer’ without receiving Beethoven as part of results. The composer I am referring to is this. Composer is a package manager tracking local dependencies of your projects and libraries.

Composer lets you specify your dependencies in a composer.json file looks like this:

[code lang=”javascript”]
{
“require”: {
“doctrine/common”: “2.1.*”,
“monolog/monolog”: “>=1.0,<1.2-dev”,
“swiftmailer/swiftmailer”: “>=4.1.2,<4.2-dev”,
“twig/twig”: “>=1.1,<2.0-dev”
}
}
[/code]

This file will install the components into the a vendor folder on the directory where you execute the following:

[code lang=”bash”]php composer.phar install[/code]

Leave a Reply

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