解决 Composer 报错 InvalidArgumentException

作者: zengde 分类: php 发布时间: 2021-12-13 03:18

该镜像源 Packagist / Composer 中国全量镜像 已经使用了好多年了,怎么突然就挂了呢?网上也搜不到它的 停服 消息。

考虑到国内的网络环境,得重新找一个镜像源。

经过一番网罗,笔者最终敲定选用 阿里云 Composer 全量镜像,配置命令:

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

其他的推荐镜像源:

次选镜像源:

列为次选是因为还未支持 Composer2,运行时会有 黄色警告

Composer 2 repository support for https://mirrors.xxx.com/composer has been disabled due to what seems like a misconfiguration. If this is a packagist.org mirror we recommend removing it as Composer 2 handles network operations much faster and should work fine without.

来源:

https://zhuanlan.zhihu.com/p/329062713