常见php compser 源地址,可以设置国内源,方便更新
阿里云
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 repo.packagist composer https://packagist.phpcomposer.com
重置 composer 源地址
composer config -g --unset repos.packagist
查看 composer 主目录:
通过 composer config -l -g 命令可以列出 composer 的全局配置信息,在这些信息中查找 [home] 配置项就是 composer 的主目录。
Linux 用户请执行 sudo composer config -l -g 命令。
进入 composer 的主目录,打开 config.json 文件(如果没有就自己创建一个),然后增加本镜像服务的配置信息,最终内容如下:
{
"config": {
},
"repositories": [
{"type": "composer", "url": "https://packagist.phpcomposer.com"},
{"packagist": false}
]
}