How to fix "https://repo.packagist.org/packages.json does not contain valid Json"?
I had the same problem. After days of searching, I found a solution. It seems a PHP problem. Try to comment a line of curl extension on php.ini. I am using php version 5.6.
extension=php_curl.dll
Type ; before the extension name, at least it will be like this:
;extension=php_curl.dll
same problem here, since php updated to 7.2.17. On a centos 7 with php 7.2.16 composer run just fine... Rollback to 7.2.16 is for now the only solution found...
Edit : Seems to be a symfony flex issue : https://github.com/symfony/flex/issues/484
Could also be IPv6 related, if your provider/system is configured for IPv6 but has no valid IPv6 route out to the internet.
This happened to me, and doing
sysctl -w net.ipv6.conf.all.disable_ipv6=1
(as root), then trying composer again fixed the issue.
To permanently apply it, add the rule to /etc/sysctl.conf (or wherever your OS preferred is)