PHPackages                             thesnackalicious/multidotenv - 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. thesnackalicious/multidotenv

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

thesnackalicious/multidotenv
============================

Simple per-environment .env files for Laravel 5.

892PHP

Since Jun 1Pushed 10y ago1 watchersCompare

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

READMEChangelogDependenciesVersions (1)Used By (0)

multidotenv
===========

[](#multidotenv)

> Simple per-environment .env files for Laravel 5.

multidotenv is a package for Laravel 5 that provides functionality to load an additional environment-specific .env file.

How it works
------------

[](#how-it-works)

Laravel 5 uses the [dotenv](https://github.com/bkeepers/dotenv) package to load the `.env` file in the root directory. multidotenv extends Laravel 5 so that an additional `.env` file is loaded depending on the environment name.

For example, given a `.env` file containing:

```
DB_HOST=localhost
DB_DATABASE=my_project
DB_USERNAME=root
DB_PASSWORD=root

```

and a `.env.testing` file containing:

```
DB_DATABASE=my_project_testing

```

when running the command `php artisan migrate --env=testing` the loaded enviroment variables would be:

```
DB_HOST=localhost
DB_DATABASE=my_project_testing
DB_USERNAME=root
DB_PASSWORD=root

```

Note that this package will always load `'.env.' . $app->environment()` if it exists. This is normally what `APP_ENV` is set to but can be overridden when using artisan by passing the `--env` flag. If neither of these are true Laravel 5 will use `production` by default.

### What about HTTP requests?

[](#what-about-http-requests)

You can leverage the 'always loading' functionality mentioned above to load a per-environment `.env` file for HTTP requests too.

For example in your `.env` file set your `APP_ENV` variable to `foo`. Now even over HTTP requests the `.env.foo` file will be loaded if it exists.

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

[](#installation)

Add `thesnackalicious/multidotenv` to your `composer.json` file:

```
"require": {
  "thesnackalicious/multidotenv": "dev-master"
}

```

Use `composer` to install this package.

```
$ composer update

```

### Update Web Kernel and Console Kernal

[](#update-web-kernel-and-console-kernal)

Add a `bootrappers()` function to the `app/Http/Kernel.php` file and the `app/Console/Kernel.php` file:

```
/**
 * Get the bootstrap classes for the application.
 *
 * @return array
 */
protected function bootstrappers()
{
    $search = 'Illuminate\Foundation\Bootstrap\DetectEnvironment';
    $replacement = 'TheSnackalicious\MultiDotEnv\DetectEnvironment';

    return array_map(function($v) use ($search, $replacement) {
        return $v == $search ? $replacement : $v;
    }, $this->bootstrappers);
}

```

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community9

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/a5ac68d5e9a1660d566d3301a07252733d6e6892c54689110b382d2619c282b0?d=identicon)[thesnackalicious](/maintainers/thesnackalicious)

---

Top Contributors

[![jamesbrauman](https://avatars.githubusercontent.com/u/1854936?v=4)](https://github.com/jamesbrauman "jamesbrauman (11 commits)")

### Embed Badge

![Health badge](/badges/thesnackalicious-multidotenv/health.svg)

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

PHPackages © 2026

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