PHPackages                             justbetter/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. justbetter/dotenv

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

justbetter/dotenv
=================

Module to overwrite and set environment variables

1.2.0(1y ago)714.0k↑316.7%PHPPHP &gt;=8.0

Since Sep 4Pushed 1y ago5 watchersCompare

[ Source](https://github.com/justbetter/magento2-dotenv)[ Packagist](https://packagist.org/packages/justbetter/dotenv)[ RSS](/packages/justbetter-dotenv/feed)WikiDiscussions master Synced 3w ago

READMEChangelog (1)Dependencies (2)Versions (7)Used By (0)

Magento 2 DotEnv loader
=======================

[](#magento-2-dotenv-loader)

Adds support for .env configuration files to Magento 2. Variables in the .env file are used to fill in `app/etc/env.php` variables. This file can be added to source control when using this package. I think having more than one environment file is weird.

Credits
-------

[](#credits)

Credits to [this package](https://github.com/Pr00xxy/magento2-dotenv) which inspired me to make this package.

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

[](#installation)

- `composer require justbetter/dotenv`
- Copy the `.env.example` [example file](Example/.env.example) to `app/etc/.env`, or. `.env` and fill in your environment variables.
- Replace the `env.php` with this [one](Example/env.php) and commit it to source control.
- `bin/magento setup:upgrade`

Extending the environments
--------------------------

[](#extending-the-environments)

You can override specific environments with the APP\_ENV variable in the dot env filename. [example](Example/.env.development.example). Copy the file to `app/etc/` and modify for any specified environment.

You can also load additional .env files by defining them in `LOAD_BEFORE` (allowing the values in these files to be overridden) or `LOAD_AFTER` (allowing the values in these files to override all others) with your extra .env files you would like to load.

Disabled the writer to env.php
------------------------------

[](#disabled-the-writer-to-envphp)

Because of the Writer class of magento 2 the `env.php` get rewrited every time. I disabled this functionality because the `env.php` file is not static. The cache types are not reset every time when you run `bin/magento setup:upgrade`.

Compatibility
-------------

[](#compatibility)

The module is tested on Magento version 2.4.x

Ideas, bugs or suggestions?
---------------------------

[](#ideas-bugs-or-suggestions)

Please create a [issue](https://github.com/justbetter/magento2-sentry/issues) or a [pull request](https://github.com/justbetter/magento2-sentry/pulls).

About us
--------

[](#about-us)

We’re a innovative development agency from The Netherlands building awesome websites, webshops and web applications with Laravel and Magento. Check out our website [justbetter.nl](https://justbetter.nl) and our [open source projects](https://github.com/justbetter).

License
-------

[](#license)

[MIT](LICENSE)

---

[![JustBetter logo](https://raw.githubusercontent.com/justbetter/art/master/justbetter-logo.png)](https://justbetter.nl "JustBetter")

###  Health Score

39

—

LowBetter than 85% of packages

Maintenance35

Infrequent updates — may be unmaintained

Popularity30

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor1

Top contributor holds 50% 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 ~296 days

Recently: every ~370 days

Total

6

Last Release

636d ago

PHP version history (2 changes)1.0.0PHP &gt;=7.0

1.2.0PHP &gt;=8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/2d00b3f55cd4ae8b8cfb001a644ed6c7a1127a956c24375bcfe16ce12bd89bed?d=identicon)[justbetter](/maintainers/justbetter)

---

Top Contributors

[![indykoning](https://avatars.githubusercontent.com/u/15870933?v=4)](https://github.com/indykoning "indykoning (5 commits)")[![rakibabu](https://avatars.githubusercontent.com/u/14089150?v=4)](https://github.com/rakibabu "rakibabu (5 commits)")

### Embed Badge

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

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

###  Alternatives

[elgentos/regenerate-catalog-urls

Regenerate Catalog URL Rewrites (products, categories, cms pages)

2842.6M](/packages/elgentos-regenerate-catalog-urls)[myparcelnl/magento

A Magento 2 module that creates MyParcel labels

1859.0k](/packages/myparcelnl-magento)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)[loki/magento2-components

Core module for defining Alpine.js components with advanced AJAX features

1010.0k22](/packages/loki-magento2-components)

PHPackages © 2026

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