Using Composer

Using Composer

Composer is the package manager used by modern PHP applications. Use Composer to manage dependencies in your Symfony applications and to install Symfony Components in your PHP projects.

Since this article was first published, Composer installation has improved a lot. Therefore, the original contents of this article have been removed and you are encouraged to install Composer as explained in the official Composer documentation.

* Download Composer
Run this in your terminal to get the latest Composer version:

* 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');"

This installer script will simply check some php.ini settings, warn you if they are set incorrectly, and then download the latest composer.phar in the current directory. The 4 lines above will, in order:

1. Download the installer to the current directory
2. Verify the installer SHA-384 which you can also cross-check here
3. Run the installer
4. Remove the installer