原文作者:xiegangd
转自链接:https://learnku.com/articles/15977/composer-accelerate-and-modify-mirror-source-in-chinacn.bing.com
版权声明:著作权归作者所有。商业转载请联系作者获得授权,非商业转载请保留以上作者信息和原文链接。
由于默认情况下执行 composer
各种命令是去国外的 composer
官方镜像源获取需要安装的具体软件信息,所以在不使用代理、不翻墙的情况下,从国内访问国外服务器的速度相对比较慢
可以使用阿里巴巴提供的 Composer
全量镜像 https://mirrors.aliyun.com/composer/
composer config repo.packagist composer https://mirrors.aliyun.com/composer/
取消当前项目配置
composer config --unset repos.packagist
composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/
取消全局配置
composer config -g --unset repos.packagist
composer
镜像源crm composer registry manager
crm
composer global require slince/composer-registry-manager
composer repo:ls
-- --------------- ------------------------------------------------
composer https://packagist.org
phpcomposer https://packagist.phpcomposer.com
aliyun https://mirrors.aliyun.com/composer
tencent https://mirrors.cloud.tencent.com/composer
huawei https://mirrors.huaweicloud.com/repository/php
laravel-china https://packagist.laravel-china.org
cnpkg https://php.cnpkg.org
sjtug https://packagist.mirrors.sjtug.sjtu.edu.cn
-- --------------- ------------------------------------------------
aliyun
镜像源composer repo:use aliyun
# 执行成功之后会输出类似以下信息
[OK] Use the repository [aliyun] success
composer repo:ls
命令,看到前面带 *
的就是当前使用的镜像composer repo:ls
# 可以看到 aliyun 前面有一个 * 号,代表当前使用的是 aliyun 的源
--- --------------- ------------------------------------------------
composer https://packagist.org
phpcomposer https://packagist.phpcomposer.com
* aliyun https://mirrors.aliyun.com/composer
tencent https://mirrors.cloud.tencent.com/composer
huawei https://mirrors.huaweicloud.com/repository/php
laravel-china https://packagist.laravel-china.org
cnpkg https://php.cnpkg.org
sjtug https://packagist.mirrors.sjtug.sjtu.edu.cn
--- --------------- ------------------------------------------------
更多用法查看 crm GitHub