"https://packagist.org/packages.json" file could not be downloaded

I noticed that this also happens when changing the networks. If I put the comüputer to sleep and then continue connected to other networks this happens. So either restart the computer or your docker. Seems to work for me. Had the issue 2 times already.


The fix for me was found here: https://getcomposer.org/doc/articles/troubleshooting.md#operation-timed-out-ipv6-issues-.

I had to disable IPv6 on my network interfaces. After disabling that, composer worked fine.


You need to tell composer to use a proxy.

Linke here: PHP Composer behind http proxy and Composer cannot download files

Like:

export HTTP_PROXY="http://my-corp-proxy.mcdonalds"
php composer.phar install

Linux users can run this command to resolve this issue:

sudo sh -c "echo 'precedence ::ffff:0:0/96 100' >> /etc/gai.conf"

More Information