gene/module-envphp-modules

There is no license information available for the latest version (0.1.2) of this package.

Magento 2 module to allow enabling a module in env.php rather than config.php, useful for require-dev dependencies

Maintainers

Package info

github.com/genecommerce/module-envphp-modules

Type:magento2-component

pkg:composer/gene/module-envphp-modules

Transparency log

Statistics

Installs: 0

Dependents: 0

Suggesters: 0

Stars: 1

Open Issues: 1

0.1.2 2026-07-20 10:36 UTC

This package is auto-updated.

Last update: 2026-08-04 15:01:43 UTC


README

This module allows you to enable a module in app/etc/env.php rather than app/etc/config.php.

This is useful for require-dev dependencies which by default inject their module status into app/etc/config.php, but are never deployed as actual dependencies.

Benefits

This improves developer experience by preventing conflicts and changes on the app/etc/config.php, composer.json, and composer.lock files. All modules are committed in, but the module is only enabled on developer machines. This allows us to ensure dev teams are working with all the tools necessary to deliver high quality software.

This helps maintains zero downtime deployments by allowing module:config:status and setup:db:status to understand that these developer dependencies are purposefully not present, and not a cause for concern.

Installation

composer require gene/module-envphp-modules
php bin/magento setup:upgrade

echo "app/etc/gene_envphp_modules/di.xml" >> .gitignore
echo "setup/config/autoload/gene-envphp-modules.global.php" >> .gitignore

Usage

You may have a developer dependency like https://github.com/tddwizard/magento2-fixtures, the standard way to install is like so

composer require --dev tddwizard/magento2-fixtures
php bin/magento setup:upgrade 

This will

  1. Add the module in as a require-dev dependency within composer.json
  2. Set TddWizard_Fixtures => 1 within app/etc/config.php

This module should never end upstream but it is very useful for developers and CI pipelines to have for testing, so we can flag it as enabled in env.php like so.

# If you do not need the module active during integration tests, then run without --enable-during-tests 
php bin/magento gene:envphp:enable TddWizard_Fixtures --enable-during-tests

This will

  1. Set TddWizard_Fixtures => 0 within app/etc/config.php, so this module is never active anywhere without an override in app/etc/env.php
  2. Store metadata about the module under gene_envphp_modules_configphp within app/etc/config.php
  3. Store TddWizard_Fixtures => 1 under gene_envphp_modules_envphp within app/etc/env.php

From here the module will appear enabled locally and within test executions.

Performance

This module is built to have a low footprint on the code. There are 2 main extension points

Performance - Setup Commands

The setup:upgrade, setup:db:status, module:config:status are all customised via the dependency injections in setup/config/autoload/gene-envphp-modules.global.php.

In Gene\EnvphpModules\Model\DeploymentConfigReader and Gene\EnvphpModules\Model\DeploymentConfigWriter we do a series of low impact array lookups and an is_file check per module. These changes only apply to the manually invoked setup commands.

Performance - Module List

We use app/etc/gene_envphp_modules/di.xml to inject the following custom deployment configuration model into the module list

<type name="Magento\Framework\Module\ModuleList">
    <arguments>
        <argument name="config" xsi:type="object">Gene\EnvphpModules\Model\ModuleList\DeploymentConfig</argument>
    </arguments>
</type>

On production/staging environments there will be no development modules defined in env.php, so the only additional overhead is an if condition and a lookup of the already available deployment configuration data.