08.21.2019

How to install composer to run globally

This article shows how to install composer and make composer run globally

Install composer


$ cd 

Copy all below code at a time then past into command line then press enter
php -r "copy('https://getcomposer.org/installer',
'composer-setup.php');"
php -r "if (hash_file('SHA384', 'composer-setup.php') ===
'e115a8dc7871f15d853148a7fbac7da27d6c0030b848d9b3dc09e2a0388afed865e6a3d6b3c0fad45c48e2b5fc1196ae')
{ echo 'Installer verified'; } else { echo 'Installer corrupt';
unlink('composer-setup.php'); } echo PHP_EOL;"
php composer-setup.php
php -r "unlink('composer-setup.php');"

Make composer run globally


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

Now you can run composer anywhere on your server.
Enojy!
 

Leave a comment