composer-phppackagist

Configure composer to get data from packagist.org via https


When building files in an environment that blocks outbound http requests, I get an error like:

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

Is there some way to instruct composer to use https connection to packagist?

I've experienced the issue with both 1.2.0 and 1.6.5 versions of composer.


Solution

  • You can either force composer to use https by:

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

    Or you could set in your composer.json file:

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

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