配置作曲家以通过https从packagist.org获取数据

时间:2018-07-03 16:01:57

标签: composer-php packagist

在阻止出站http请求的环境中构建文件时,出现类似以下错误:

Updating dependencies (including require-dev) The "http://packagist.org/p/provider-2013%ahash.json" file could not be downloaded: failed to open stream: Connection timed out http://packagist.org could not be fully loaded, package information was loaded from the local cache and may be out of date

有什么方法可以指示作曲家使用https连接来打包吗?

我在1.2.0和1.6.5版本的作曲家中都遇到了这个问题。

1 个答案:

答案 0 :(得分:1)

您可以通过以下方式强制作曲家使用https:

composer config -g repo.packagist composer https://packagist.org

或者您可以在composer.json文件中设置:

"repositories": [
      {
        "type": "composer",
        "url": "https://packagist.org"
      },
      { "packagist": false }
    ]

Source: issue #5656 on composer's github repository.