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
Unfortunately this didn't help me :-(
I've tried updating Composer to v1.9, then to the latest snapshot version
v1.10-dev
I ensured I'm using the latest OpenSSL version
OpenSSL 1.1.1d 10 Sep 2019
My connection is fine. It's a 100Mbit fibre connection and I can download large files fine.
I've tried on two different VMs, both running Ubuntu 18.04
I'm trying to install the composer dependencies for the Yii2-mongodb extension.
https://github.com/yiisoft/yii2-mongodb/blob/master/composer.json
None of the composer changes have helped me unfortunately. But thank you for the suggestions. At least I know I've given it a decent try.