Setting up the environment with Composer

Composer is a dependency manager for PHP, strongly inspired by Node's NPM and Bundler. It has now become integral to multiple PHP projects, including Laravel and Symfony. Why it is useful for us, however, is that it contains autoload functionality that is compliant with the PSR-0 and PSR-4 standards. You can download and install Composer from http://getcomposer.org.

Note

In order to install Composer globally on Mac OS X or Linux, first you can run the installer:

curl -sS https://getcomposer.org/installer | php

And then you can move Composer to install it globally:

mv composer.phar /usr/local/bin/composer

If the command preceding fails due to a permissions issue, rerun the command except putting sudo ...

Get Mastering PHP Design Patterns now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.