composer:install
$ php composer-setup.php
$ php -r "unlink('composer-setup.php');"
$ sudo mv composer.phar /usr/local/bin/composer
This command sequence is used to install the Composer dependency manager for PHP on a Unix-based system.
-
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
: This command downloads the Composer installer file from the official website (https://getcomposer.org/installer
) and saves it ascomposer-setup.php
in the current directory. -
php composer-setup.php
: Running this command executes the PHP script (composer-setup.php
) that was downloaded in the previous step. This script checks the integrity of the installer and sets up Composer on the system. -
php -r "unlink('composer-setup.php');"
: After the installer script has been executed, this command deletes thecomposer-setup.php
file from the current directory. This step is to clean up the unnecessary installer file. -
sudo mv composer.phar /usr/local/bin/composer
: Finally, this command moves thecomposer.phar
executable file to the/usr/local/bin
directory, which is typically included in the system's executable (PATH) environment variable. This allows you to run Composer commands from anywhere in the terminal by simply typingcomposer
.
Once these commands are successfully executed, Composer should be installed on the system and ready to manage PHP package dependencies.