1.
$ composer config repos.packagist composer https://php.cnpkg.org
$ composer config cache-files-maxsize 2048MiB
2.
vi /Users/xxx/.composer/config.json
{ "config": { "github-protocols": [ "https" ] }, "repositories": { "packagist.org": { "type": "composer", "url": "https://php.cnpkg.org" } } }
https://stackoverflow.com/questions/38635257/composer-content-length-mismatch
如果提示某个包找不到,就换个镜像源,比如:https://mirrors.aliyun.com/composer/