Using Composer
Installation (for *nix platforms)
To install Composer globally (ie not for a specific project, which is recommended) run the following commands:
curl -sS https://getcomposer.org/installer | php mv composer.phar /usr/local/bin/composer
OR
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" php -r "if (hash_file('SHA384', 'composer-setup.php') === '55d6ead61b29c7bdee5cccfb50076874187bd9f21f65d8991d46ec5cc90518f447387fb9f76ebae1fbbacf329e583e30') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;" php composer-setup.php php -r "unlink('composer-setup.php');" mv composer.phar /usr/local/bin/composer
You can now simply use "composer" instead of "php composer.phar" everywhere.
For more installation tips, see https://getcomposer.org/doc/00-intro.md#installation-nix
General Use
Composer helps manage various dependencies for PHP projects. The main focal point is a project's composer.json file, which stores information about all the dependencies Composer should install for a given project. Here's a sample from one of our projects:
{ "require": { "behat/behat": "2.4.*@stable", "drupal/drupal-extension": "*", "sanpi/behatch-contexts": "*", "behat/mink": "*" }, "minimum-stability": "dev", "config": { "bin-dir": "bin/" } }
Running "composer install" in the directory with this composer.json file will install all of the requirements (stated in the "require" block) in a "vendors" file.
Troubleshooting
When you run out of available memory for a large Composer build, you can increase memory usage by using...