How to install composer?
Composer installation method
Wondows platform
On the Wondows platform, we only need to download Composer-Setup.exe and install it step by step.
It should be noted that you need to enable openssl configuration. We open php.ini in the php directory and remove the semicolon in front of extension=php_openssl.dll.
After the installation is successful, we can enter the composer --version command through the command window (cmd) to check whether the installation is successful:
Next we can change Packagist to the domestic mirror:
composer config -g repo.packagist composer https://packagist.phpcomposer.com
Related recommendations: [composer tutorial]
Linux platform
The Linux platform can be installed using the following command:
# php -r "copy('https://install.phpcomposer.com/installer', 'composer-setup.php');" # php composer-setup.php All settings correct for using Composer Downloading... Composer (version 1.6.5) successfully installed to: /root/composer.phar Use it: php composer.phar
Move composer.phar so that composer can make global calls:
# mv composer.phar /usr/local/bin/composer
Switch to domestic mirror:
# composer config -g repo.packagist composer https://packagist.phpcomposer.com
Update composer:
# composer selfupdate
Mac OS system
Mac OS system can use the following command to install:
$ curl -sS https://getcomposer.org/installer | php $ sudo mv composer.phar /usr/local/bin/composer $ composer --version Composer version 1.7.2 2018-08-16 16:57:12
Switch to domestic mirror:
$ composer config -g repo.packagist composer https://packagist.phpcomposer.com
Update composer:
$ composer selfupdate
The above is the detailed content of How to install composer?. For more information, please follow other related articles on the PHP Chinese website!