PHPackages                             prooxxy/magento2-dotenv - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. prooxxy/magento2-dotenv

ActiveMagento2-module[Utility &amp; Helpers](/categories/utility)

prooxxy/magento2-dotenv
=======================

Adds support for .env files to Magento 2

1.3.0(5y ago)93.4kMITPHPPHP &gt;=7.1

Since Feb 27Pushed 5y ago1 watchersCompare

[ Source](https://github.com/Pr00xxy/magento2-dotenv)[ Packagist](https://packagist.org/packages/prooxxy/magento2-dotenv)[ RSS](/packages/prooxxy-magento2-dotenv/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (3)Versions (8)Used By (0)

Magento 2 .env module
=====================

[](#magento-2-env-module)

Adds support for .env configuration files to Magento 2.

This module was created because Magento [recommends](https://devdocs.magento.com/guides/v2.3/config-guide/prod/config-reference-var-name.html#how-to-use-environment-variables) injection of variables into $\_ENV through the index.php file. I believe that is a stupid suggestion.

Installation
------------

[](#installation)

Use [composer](https://getcomposer.org/) to install this.

```
composer require prooxxy/magento2-dotenv
```

### Alternative installation

[](#alternative-installation)

If you don't have the option to use composer it's possible to copy the root of this project into the `app/code/PrOOxxy/DotEnv` folder of your magento installation

Make sure the module is enable before start using

```
php bin/magento module:enable PrOOxxy_DotEnv
php bin/magento setup:upgrade
```

Features
--------

[](#features)

This module does only one thing once installed. It reads and parses any variables that is locate inside &lt;magento\_root&gt;/app/etc/.env and injects it into the global `$_ENV` array

It does this before Magento processes other environments variables. It does override any preexisting variable with the same name.

Usage
-----

[](#usage)

1. Add .env into app/etc The file must have chmod level 0644 or below
2. Follow the official devdocs [instructions](https://devdocs.magento.com/guides/v2.3/config-guide/deployment/pipeline/example/environment-variables.html#step-4-update-the-production-system) for how to create the env variable format
3. Add your newly formatted variables into the .env like so e.g

`CONFIG__DEFAULT__SYSTEM__SMTP__HOST="8.8.8.8"`

4. Flush the config cache

```
php bin/magento cache:flush config
```

Compability
-----------

[](#compability)

Magento 2 Open Source 2.3.x Magento 2 Open Source 2.4.x Magento 2 Commerce 2.3.x Magento 2 Commerce 2.4.x

License
-------

[](#license)

[MIT](https://choosealicense.com/licenses/mit/)

###  Health Score

29

—

LowBetter than 60% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity22

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~21 days

Recently: every ~31 days

Total

7

Last Release

2137d ago

PHP version history (2 changes)1.0.0PHP ~7.1.0|~7.2.0|~7.3.0

1.3.0PHP &gt;=7.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/892479757ef2597339c2db7c80f832aebe18c2b464a69845a087588988290449?d=identicon)[pr00xxy](/maintainers/pr00xxy)

---

Top Contributors

[![Pr00xxy](https://avatars.githubusercontent.com/u/9111275?v=4)](https://github.com/Pr00xxy "Pr00xxy (15 commits)")

---

Tags

dotenvenvenvironment-variablesmagento2magento2-extensionmagento2-extension-freemagento2-modulemagento2-pluginenvdotenvmagento 2magento module

### Embed Badge

![Health badge](/badges/prooxxy-magento2-dotenv/health.svg)

```
[![Health](https://phpackages.com/badges/prooxxy-magento2-dotenv/health.svg)](https://phpackages.com/packages/prooxxy-magento2-dotenv)
```

###  Alternatives

[vlucas/phpdotenv

Loads environment variables from `.env` to `getenv()`, `$\_ENV` and `$\_SERVER` automagically.

13.5k602.4M5.4k](/packages/vlucas-phpdotenv)[symfony/dotenv

Registers environment variables from a .env file

3.8k226.7M2.2k](/packages/symfony-dotenv)[helhum/dotenv-connector

Makes it possible to set environment variables for composer projects.

1594.6M33](/packages/helhum-dotenv-connector)[m1/env

Env is a lightweight library bringing .env file parser compatibility to PHP. In short - it enables you to read .env files with PHP.

6412.0M21](/packages/m1-env)[sroze/companienv

Companion for .env files

245418.8k1](/packages/sroze-companienv)[bnomei/kirby3-dotenv

Kirby Plugin for environment variables from .env

4144.1k1](/packages/bnomei-kirby3-dotenv)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
