0

最近使用composer进行php依赖管理,但是国内镜像http://packagist.phpcomposer.com不能进行访问,国外镜像访问速度很慢,请问大神还有什么其他的国内镜像或好的解决方法吗?

clipboard.png

2016-03-01 提问

查看全部 9 个回答

1

已采纳

那是因为composer默认用Https协议请求,国内镜像之前是http的,貌似现在换了

推荐答案

3
your configuration does not allow to connection to `http://xxxxxxx`,see the https://getcomposer.org/doc/06-config.md#secure-http for details.

打开https://getcomposer.org/doc/06-config.md#secure-http看看

secure-http#

Defaults to true. If set to true only HTTPS URLs are allowed to be downloaded via Composer. If you really absolutely need HTTP access to something then you can disable it, but using Let's Encrypt to get a free SSL certificate is generally a better alternative.

默认是必须使用https的,而你使用的镜像是http的。
也就是在,config.json中配置

{
    "config": {
        "secure-http": false
    }
}

另外,如果有爬墙资源的话,可以参考下这个:
https://segmentfault.com/a/1190000000518008

推广链接