Composer安装使用及换源,适用于Linux和macOS系统。
- 安装Composer
安装composer很简单:
curl -sS https://getcomposer.org/installer | php
mv composer.phar /usr/local/bin/composer
- 使用Composer
使用composer安装package
composer global require "fxp/composer-asset-plugin:^1.3.1"
composer create-project yiisoft/yii2-app-basic basic 2.0.12
- Composer换源
国外的源速度慢且不稳定,可以换成国内的源,比如阿里云的。
composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/