Finally, the answer was in an apparent corruption of the composer installation, or a missing configuration. The solution is described in StackOverflow: composer-content-length-mismatch and includes the following steps:
List composer settings with
composer config --list --global
This will show among other settings the directory that composer considers as [home]
. For example
[home] /home/{username}/.composer
Within that directory, you must edit the file config.json
to force the use of https when connecting to packagist
{
"config": {
"github-protocols": [
"https"
]
},
"repositories": {
"packagist": {
"type": "composer",
"url": "https://packagist.org"
}
}
}
The answer also suggests adding an entry to the repositories
section of the file composer.json
of your project. In this case, add packagist explicitly as a repository . An example of how the composer.json
of laravel would be included:
{
"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"
}
}
}
I repeat, I am only replicating what is contained in the answer of S.O. that I linked in my comment.