Composer Won't Install "require-dev" Packages


Answer :

Composer only ever installs the packages listed as "require-dev" of your main composer.json file, and if these packages do need something else, then only their "require" packages are installed, but not their "require-dev" packages.


This actually is a good thing. If you want to contribute to an existing software package, you'd clone their repository, install everything needed for development, and are ready to contribute. But if you require that package for your own software, this is no use case to develop that particular package - it is the use case to develop your own software.


So the tl;dr: Composer only installs the development requirements of the composer.json, not of any dependencies.



There is a solution for installing the require-dev packages of a vendor into your project.



https://github.com/wikimedia/composer-merge-plugin



Add this into your composer.json of your project



{
"require": {
"wikimedia/composer-merge-plugin": "dev-master"
},
"extra": {
"merge-plugin": {
"include": [
"vendor/laravel/framework/composer.json"
]
"recurse": true,
"replace": false,
"ignore-duplicates": false,
"merge-dev": true,
"merge-extra": false,
"merge-extra-deep": false,
"merge-scripts": false
}
}
}


It is important to have "merge-dev": true,
run



composer update


And the require-dev packages of "vendor/laravel/framework/composer.json" will be installed in your project.



Comments

Popular posts from this blog

Converting A String To Int In Groovy

"Cannot Create Cache Directory /home//.composer/cache/repo/https---packagist.org/, Or Directory Is Not Writable. Proceeding Without Cache"

Android How Can I Convert A String To A Editable