1. 查看 composer 配置项:
composer config -g -l
或
composer config --list
2. 设置 composer 的源地址:
中国全量镜像
composer config -g repo.packagist composer https://packagist.phpcomposer.com
切换到国内源 阿里
composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/
切换到国内源 腾讯
composer config -g repos.packagist composer https://mirrors.cloud.tencent.com/composer/
解除镜像(还原)执行之后,composer 会利用默认值(也就是官方源)重置源地址。
composer config -g --unset repos.packagist
3. 执行命令设置 composer 超时时间,注意:如下设置如果不起作用,请确定你当前所在目录的项目下的 composer.json 里是否已经设置了该值。
composer config -g process-timeout 600
4. 清除缓存
composer clear-cache