composer國內鏡像不能使用

來源:互聯網
上載者:User

最近使用composer進行php依賴管理,但是國內鏡像http://packagist.phpcomposer.com不能進行訪問,國外鏡像訪問速度很慢,請問大神還有什麼其他的國內鏡像或好的解決方案嗎?

回複內容:

最近使用composer進行php依賴管理,但是國內鏡像http://packagist.phpcomposer.com不能進行訪問,國外鏡像訪問速度很慢,請問大神還有什麼其他的國內鏡像或好的解決方案嗎?

那是因為composer預設用Https協議請求,國內鏡像之前是http的,貌似現在換了

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

我覺得吧!
還是用國外鏡像好:
1、Composer從GitHub拉取代碼檔案,Github掛了你也用不了
2、還不如做個翻/牆。

之前在用的國內鏡像:
Packagist

好像官網有說明 phpcomposer
或者將.composer/config.json修改成

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

http://pkg.phpcomposer.com/ 這個應該好用啊 我前天還用了。。

http://pkg.phpcomposer.com/ 可以切換至中國鏡像。

現在好用了,謝謝大家的協助

  • 相關文章

    聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.