First, run:
$ composer config --list --global //this will get the composer home path.
[home] /root/.composer //it's my composer home path.
And then, edit the config.json in [home]
directory, make it like this:
{
"config": {
"github-protocols": [
"https,ssh"
]
},
"repositories": {
"packagist": {
"type": "composer",
"url": "https://packagist.org"
}
}
}
It will make the packagist connection force https. And also you could config the composer.json in your project, this is a laravel sample would be look like:
{
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": [
"framework",
"laravel"
],
"license": "MIT",
"type": "project",
"require": {
"php": ">=5.5.9",
"laravel/framework": "5.2.*"
},
"config": {
"preferred-install": "dist"
},
"repositories": {
"packagist": {
"type": "composer",
"url": "https://packagist.org"
}
}
}
Source: http://stackoverflow.com/questions/38635257/composer-content-length-mismatch
`The "https://repo.packagist.org/p/provider-2019%24301f2ee16ec6aa29e1b91deb75a805d8329d6579b8a42054396d1b042839ab2b.json" file could not be downloaded: SSL: An existing connection was forcibly closed by the remote host.
failed to open stream: HTTP request failed!
https://repo.packagist.org could not be fully loaded, package information was loaded from the local cache and may be out of date
`