Linux 平台
Linux 平台可以使用以下命令来安装:
1.方法1
下载composer压缩包
wget https://getcomposer.org/composer.phar
移动到全局
cp composer.phar /usr/local/bin/composer
更改权限
chmod u+x /usr/local/bin/composer
检测是否成功
composer --help
在项目根目录下安装guzzlehttp/guzzle
composer require guzzlehttp/guzzle
2.方法2
# 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
移动 composer.phar,这样 composer 就可以进行全局调用:
# mv composer.phar /usr/local/bin/composer
切换为国内镜像:
# composer config -g repo.packagist composer https://packagist.phpcomposer.com
更新 composer:
# composer selfupdate