zend-component-installer
zend-component-installer copied to clipboard
Automatically inject into config file if there's one choice
I think that the question
Please select which config file you wish to inject 'My\Package\ConfigProvider' into
should never appear if there's only one option that isn't "do not inject".
I think that the use-case for not installing into the default choice when there's only one choice is so esoteric and rare that the few users that don't need it can choose to use their VCS to remove the change to that file.
I do not think that automatically inject anything is a good idea. There are lots of use cases where you do not want to inject to config. Especially if I need just one module, but another module is installed together due to dependency.
There should never be automatic injection.
@axelcho From a support perspective: we've fielded a large number of questions from folks who indicate that functionality from a component "is not working", where the root cause is that the ConfigProvider for that component was not installed. This gets far more complicated when a component has dependencies that also define ConfigProvider classes, as then you have to play whack-a-mole until you get all of them registered.
We've seen the number of such questions decrease tremendously since we changed the default from "do not inject" to instead point to the recommended file to inject; developers are more likely to just hit enter and accept, which means the injection happens by default.
While I understand your perspective (I was a proponent of having "do not inject" as the default originally), my experience in helping users has shifted my recommendation to inject by default, due to the amount of confusion it causes when we do not. As @akrabat notes, if you do not want the injection, you're also likely using version control, and can quickly and easily revert the changes to your configuration files.
@weierophinney I think that @axelcho is right. The folks who complain about a component that "is not working" but the problem was somewhere between the chair and the keyboard should read the docs before asking questions. In this moment I have a stupid issue about this injection.... I do not want to use the config providers for some components, but when I run composer install.... it automatically injects some config providers in my config file (i have chosen "Remember this option for other packages of the same type?" believing it will affect only the current composer install not all future composer installs). So, in this case I have to use config providers (which I don't want) or delete the injections after each composer install (not so cool because my deployment script will not know how to delete the injections and because it is an automated deployment ... I don't want to edit the config myself).
This repository has been closed and moved to laminas/laminas-component-installer; a new issue has been opened at https://github.com/laminas/laminas-component-installer/issues/3.