composer镜像大全

作者: zengde 分类: 笔记 发布时间: 2024-09-09 06:15

默认全局配置

阿里云
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

  1. 阿里云 Composer 全量镜像
  2. 腾讯云 Composer 全量镜像
  3. 华为云 Composer 全量镜像
  4. Packagist Mirror (上海交通大学)
  5. 中国全量镜像

如何切换镜像,例如,要使用阿里云的全量镜像

全局配置

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