首页 > composer国内镜像不能使用

composer国内镜像不能使用

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


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://.com/a/1190000000518008


http://pkg.phpcomposer.com/ 可以切换至中国镜像。


之前在用的国内镜像:
Packagist


好像官网有说明 phpcomposer
或者将.composer/config.json修改成

{
    "config": [],
    "repositories": {
        "packagist": {
            "type": "composer",
            "url": "https://packagist.phpcomposer.com"
        }
    }
}

我觉得吧!
还是用国外镜像好:
1、Composer从GitHub拉取代码文件,Github挂了你也用不了
2、还不如做个翻/墙。


现在好用了,谢谢大家的帮助


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


http://pkg.phpcomposer.com/ 这个应该好用啊 我前天还用了。。

【热门文章】
【热门文章】