Join GitHub today
Using `composer install --no-interaction` is injecting modules into modules.config.php #56
This seems like a bug to me. I can add
Desired Outcome: using command should choose the default which is listed as
Default is set to
composer file being used:
This is how Composer works with the
We switched from defaulting to no injection to injecting with version 2 of this component because we handled far too many problems from users who selected the default behavior (no injection) and then couldn't understand why the code wasn't working. We found it was better from a general usability perspective to default to inject, as that was the expected behavior.
Generally speaking, if I want to install without interaction, I generally do not want scripts running, either. Most build commands I've seen that prepare the production install use the combination
@Xerkus Please read what I wrote above; we're not going to change this back, because defaulting to no injection led to a ton of support issues. We have far fewer support problems regarding modules today due to this change.
Additionally, interactive mode defaults to injection, which is exactly what non-interactive does as well. It's only when you apply the
@weierophinney I guess we are in a sad state of development these days... albeit we need all the adoption we can get.
Anyhow, this statement is false AFAIK and @Xerkus is correct. Maybe it does (haven't tested myself yet) default to inject under the hood but, then that means the output is incorrect when in interactive mode that shows
I have shown the defaults in interactive mode in my post above as being
@worthwhileindustries Which versions of the following are you using, please?
Based on what you've reported, I created a zend-mvc project using the following:
$ composer create-project zendframework/skeleton-application test
I chose the minimal installation option. Once created, I entered the project, updated all dependencies, and also updated to the latest zend-component-installer:
$ composer update $ composer require "zendframework/zend-component-installer:^2.0"
Which installed version 2.1.1.
Now, I decided to test installing zend-form, as you did.
First, I used interaction:
$ composer require zendframework/zend-form Using version ^2.12 for zendframework/zend-form ./composer.json has been updated Loading composer repositories with package information Updating dependencies (including require-dev) Package operations: 4 installs, 0 updates, 0 removals - Installing zendframework/zend-hydrator (2.4.0): Loading from cache Please select which config file you wish to inject 'Zend\Hydrator' into:  Do not inject  config/modules.config.php  config/development.config.php.dist Make your selection (default is 1):
So, with an up-to-date version of zend-component-installer, we can see that the default is to inject to a production configuration.
I aborted, and then tried without interaction:
$ composer require --no-interaction zendframework/zend-form Using version ^2.12 for zendframework/zend-form ./composer.json has been updated Loading composer repositories with package information Updating dependencies (including require-dev) Package operations: 4 installs, 0 updates, 0 removals - Installing zendframework/zend-hydrator (2.4.0): Loading from cache Installing Zend\Hydrator from package zendframework/zend-hydrator - Installing zendframework/zend-filter (2.8.0): Loading from cache Installing Zend\Filter from package zendframework/zend-filter - Installing zendframework/zend-inputfilter (2.8.2): Loading from cache Installing Zend\InputFilter from package zendframework/zend-inputfilter - Installing zendframework/zend-form (2.12.0): Loading from cache Installing Zend\Form from package zendframework/zend-form zendframework/zend-hydrator suggests installing zendframework/zend-serializer (^2.6.1, to use the SerializableStrategy) zendframework/zend-filter suggests installing zendframework/zend-crypt (Zend\Crypt component, for encryption filters) zendframework/zend-filter suggests installing zendframework/zend-i18n (Zend\I18n component for filters depending on i18n functionality) zendframework/zend-form suggests installing zendframework/zend-captcha (^2.7.1, required for using CAPTCHA form elements) zendframework/zend-form suggests installing zendframework/zend-code (^2.6 || ^3.0, required to use zend-form annotations support) zendframework/zend-form suggests installing zendframework/zend-i18n (^2.6, required when using zend-form view helpers) zendframework/zend-form suggests installing zendframework/zendservice-recaptcha (in order to use the ReCaptcha form element) Writing lock file Generating autoload files
Note that it does inject; after each component is installed, it mentions it is installing the component. I verified by inspecting my
return [ 'Zend\Form', 'Zend\InputFilter', 'Zend\Filter', 'Zend\Hydrator', 'Zend\Router', 'Zend\Validator', 'Application', ];
So, my take is: you're using the old 0.X series of zend-component-installer that's bundled in the framework. Upgrade that, and you'll observe the behavior I described.
Now, I see two action items based on this:
The former is likely something to include both in the installer's documentation, as well as in the Expressive and zend-mvc tutorials.
The latter is something for the zendframework/ZendSkeletonApplication repository.
And, final point: what I demonstrate above is that the behavior is the same regardless of whether or not the
@weierophinney I haven't tried updating all the things but, just for reference this is what my versions look like for this particular issue originally posted.