composer镜像大全
默认全局配置
阿里云
composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/
华为云
composer config -g repo.packagist composer https://mirrors.huaweicloud.com/repository/php/
腾讯云
composer config -g repos.packagist composer https://mirrors.cloud.tencent.com/composer/
phpcomposer Composer官方镜像(速度慢的一匹)
composer config -g repo.packagist composer https://packagist.phpcomposer.com
Packagist 中国全量镜像(由安畅网络赞助)
composer config -g repo.packagist composer https://php.cnpkg.org
Packagist / JP 日本镜像(一个日本开发者搭建的镜像)
composer config -g repo.packagist composer https://packagist.jp/
Packagist Mirror 上海交通大学镜像
composer config -g repo.packagist composer https://packagist.mirrors.sjtug.sjtu.edu.cn/
Packagist 清华大学镜像
composer config -g repo.packagist composer https://mirrors.tuna.tsinghua.edu.cn/composer/
laravel-china (已经停止维护)
composer config -g repos.packagist composer https://packagist.laravel-china.org
- 阿里云 Composer 全量镜像
- 镜像地址: https://mirrors.aliyun.com/composer/
- 官方地址: https://mirrors.aliyun.com/composer/index.html
- 镜像类型: 全量镜像
- 更新时间: 1分钟
- 备注: 阿里云CDN加速,更新速度快,推荐使用。
- 腾讯云 Composer 全量镜像
- 镜像地址: https://mirrors.cloud.tencent.com/composer/
- 官方地址: https://mirrors.cloud.tencent.com/composer/
- 备注: 若使用腾讯云服务器,可将源的域名从
mirrors.cloud.tencent.com
改为mirrors.tencentyun.com
,使用内网流量不占用公网流量。
- 华为云 Composer 全量镜像
- 镜像地址: https://mirrors.huaweicloud.com/repository/php/
- 官方地址: https://mirrors.huaweicloud.com/
- 备注: 华为composer镜像目前还不够完善,同步速度也比较慢,可能并非全量。
- Packagist Mirror (上海交通大学)
- 镜像地址:https://packagist.mirrors.sjtug.sjtu.edu.cn/
- 官方地址: https://mirrors.sjtug.sjtu.edu.cn/packagist/
- 备注: 上海交通大学提供的composer镜像,稳定、快速、现代的镜像服务,推荐使用。
- 中国全量镜像
- 镜像地址:https://packagist.phpcomposer.com/
- 备注: 提供了国内的全量composer镜像服务。
如何切换镜像,例如,要使用阿里云的全量镜像
全局配置
composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/
取消设置全局镜像源可以使用以下命令:
composer config -g --unset repos.packagist
项目配置
仅修改当前工程配置,仅当前工程可使用该镜像地址:
composer config repo.packagist composer https://mirrors.aliyun.com/composer/
取消配置:
composer config --unset repos.packagist