1. 把默认的 secure-http 改成false
composer config -g secure-http false
2. 修改配置文件
#修改全局文件(推荐)
composer config -g repo.packagist composer https://packagist.phpcomposer.com
#修改当前配置文件
composer config repo.packagist composer https://packagist.phpcomposer.com
最后修改composer.json 文件
{
"repositories": {
"packagist": {
"type": "composer",
"url": "https://packagist.phpcomposer.com"
}
}
}