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

ActiveComposer-plugin[Utility &amp; Helpers](/categories/utility)

bangpound/composer-dotenv
=========================

Load environment variables from `.env` when Composer runs

730.5k—0%[1 issues](https://github.com/bangpound/composer-dotenv/issues)PHP

Since Aug 22Pushed 9y ago1 watchersCompare

[ Source](https://github.com/bangpound/composer-dotenv)[ Packagist](https://packagist.org/packages/bangpound/composer-dotenv)[ RSS](/packages/bangpound-composer-dotenv/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Composer Dotenv
===============

[](#composer-dotenv)

Whenever Composer is activated in a project with a `.env` file, this plugin will use the [`vlucas/phpdotenv`](https://github.com/vlucas/phpdotenv) library to load this configuration file into the PHP envrionment.

This plugin works well with `incenteev/composer-parameter-handler`[which allows you to map environment variables to parameters](https://github.com/Incenteev/ParameterHandler#using-environment-variables-to-set-the-parameters). *This* plugin runs when composer is activated, and ParameterHandler finds that configuration in the environment after your dependencies have been installed or updated.

Example
-------

[](#example)

If your `.env` file contains:

```
SECRET_FOR_ME="123456"

```

And your `composer.json` file contains:

```
{
    "require": {
        "incenteev/composer-parameter-handler": "~2.0",
        "bangpound/composer-dotenv": "~1.0@dev"
    },
    "extra": {
        "incenteev-parameters": {
            "file": "app/config/parameters.yml",
            "env-map": {
                "secret": "SECRET_FOR_ME"
            }
        }
    },
    "scripts": {
        "post-install-cmd": [
            "Incenteev\\ParameterHandler\\ScriptHandler::buildParameters"
        ],
        "post-update-cmd": [
            "Incenteev\\ParameterHandler\\ScriptHandler::buildParameters"
        ]
    },
}
```

Then after running composer update or install, your `app/config/parameters.yml`will contain:

```
# This file is auto-generated during the composer install
parameters:
    secret: 123456
```

Settings
--------

[](#settings)

In the `extra` property of the root repository, change these values as necessary:

```
{
    "extra": {
        "dotenv": {
            "path": ".",
            "file": ".env"
        }
    }
}
```

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance17

Infrequent updates — may be unmaintained

Popularity30

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity41

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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/b64376d484202faf7cf4e423ba5b70f202f870644666c9b1e7ae7107dd91f299?d=identicon)[bangpound](/maintainers/bangpound)

---

Top Contributors

[![bangpound](https://avatars.githubusercontent.com/u/6731?v=4)](https://github.com/bangpound "bangpound (13 commits)")

### Embed Badge

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

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

###  Alternatives

[tightenco/ziggy

Use your Laravel named routes in JavaScript.

4.3k41.6M267](/packages/tightenco-ziggy)[ph2m/gdpr

Magento 1 GDPR module

231.3k](/packages/ph2m-gdpr)

PHPackages © 2026

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