Composer is a dependency manager for php that is very similar in operation to npm for nodejs. It can be a welcome alternative to pear and pecl if properly implemented. Any sysadmin or developer who works with php apps would do well to get familiar with it.
Composer, like npm, can be installed to be accessible either globally or locally in a home directory. When being used on a web server, it’s probably best to install globally. It consists of a single executable that can go into /usr/local/bin.
To get composer use this curl command:
curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin
Then rename the composer.phar (“.phar” for “php archive”) to composer, resulting in “/usr/local/bin/composer”.
You can then use composer to install all sorts of php related stuff, with all their required dependencies. For example to get the Laravel development framework you would issue a command like this:
composer create-project laravel/laravel laravel-base
The main thing to understand about composer is that it is not a package manager. Instead, it installs dependencies on a per-project basis in the same way that npm does for nodejs projects. This is a paradigm shift for some people, especially sysadmins who are used to working with package management systems like rpm, yum or deb that handle dependencies on a system-wide basis. Once you wrap your head around the concept, however, you realize that it can make dependency resolution much easier. That’s because supplying dependencies on an app-by-app basis will help you avoid, among other things, versioning conflicts that almost always come up on any system that’s not at the absolute bleeding edge.
The Getting Started page on the composer web site is a good place to get familiar with this idea, as well as start down the road of mastering the tool.