composer 更换全局或项目国内镜像(真正测试用可)


网上很多文章出现的composer 国内镜像https://mirrors.aliyun.com/composer/已不能使用,早已打不开,现在目前可以用的地址阿里云:https://developer.aliyun.com/composer

composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/

更换镜像站点有两种方式: 

  1. 全局更换

  2. 局部项目更换

composer 中国镜像地址:https://packagist.laravel-china.org/


1.composer 全局更换镜像:


composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/

2.仅当前项目更换镜像:在项目目录中执行


composer config repo.packagist composer https://mirrors.aliyun.com/composer/

3.也可以修改项目中的composer.json文件:

"repositories": {
    "packagist": {
    "type": "composer",
    "url": "https://mirrors.aliyun.com/composer/"      
    }  
}


0.064257s