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') === '669656bab3166a7aff8a7506b8cb2d1c292f042046c5a994c43155c0be6190fa0355160742ab2e1c88d40d5be660b410') { 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:
- Download the installer to the current directory
- Verify the installer SHA-384 which you can also cross-check here
- Run the installer
- Remove the installer
WARNING: Please do not redistribute the install code. It will change with every version of the installer. Instead, please link to this page or check how to install Composer programmatically.
Installer Options
–install-dir
You can install composer to a specific directory by using the --install-dir
option and providing a target directory. Example:
php composer-setup.php --install-dir=bin
–filename
You can specify the filename (default: composer.phar) using the --filename
option. Example:
php composer-setup.php --filename=composer
–version
You can install composer to a specific release by using the --version
option and providing a target release. Example:
php composer-setup.php --version=1.0.0-alpha8