composer 使用教程常用知识点
使用 composer config -l -g 查看所有全局配置
composer config -l -g
设置国内镜像源一全局配置(以腾讯云为例)
composer config -g repos.packagist composer https://mirrors.tencent.com/composer
-g 指的是全局变量,如果只是单一项目配置,则是
composer config repos.packagist composer https://mirrors.tencent.com/composer
取消全局镜像源配置恢复默认的:
composer config -g --unset repos.packagist
取消当前镜像源配置:
composer config --unset repos.packagist
升级 composer(自动更新):
composer self-update
查看 composer 版本:
composer --version
如果想输出更多信息,和帮助,可以直接使用 composer -v
清除缓存:
composer clearcache
composer 官方源和镜像源:
composer config -g repo.packagist composer https://repo.packagist.org
全球,CloudFlare:
composer config -g repos.packagist composer https://packagist.pages.dev
日本,(同步频率为2分钟)
composer config -g repos.packagist composer https://packagist.jp
中国,腾讯云(同步频率为每天一次,同步的时间为 凌晨0点-2点)
composer config -g repos.packagist composer https://mirrors.tencent.com/composer
中国,阿里云(实时同步)
composer config -g repo.packagist composer https://mirrors.aliyun.com/composer
中国,上海交通大学(同步频率为每小时)
composer config -g repos.packagist composer https://packagist.mirrors.sjtug.sjtu.edu.cn
欧洲,芬兰(实时同步)
composer config -g repos.packagist composer https://packagist.fi