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

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

mykehowells/dotenv
==================

Load .env file into project environment, using same functions as Laravel

1.0.3(9y ago)29.7k1GPLPHPPHP &gt;=5.4.0

Since Mar 9Pushed 8y ago1 watchersCompare

[ Source](https://github.com/mykemeynell/dotenv)[ Packagist](https://packagist.org/packages/mykehowells/dotenv)[ Docs](https://github.com/mykemeynell/dotenv)[ RSS](/packages/mykehowells-dotenv/feed)WikiDiscussions master Synced 4w ago

READMEChangelog (3)Dependencies (1)Versions (5)Used By (1)

dotenv Environment Manager
==========================

[](#dotenv-environment-manager)

[![Stable version](https://camo.githubusercontent.com/cb6217a58dbb9451dad771340c9f7afca11c617ec22261758ea8681acb03d89b/68747470733a2f2f706f7365722e707567782e6f72672f6d796b65686f77656c6c732f646f74656e762f762f737461626c652e737667)](https://packagist.org/packages/mykehowells/dotenv)[![Unstable version](https://camo.githubusercontent.com/d183e538945b76577b11cbc58bc7fe89a2fea114afa9cd83bc565a10733ae650/68747470733a2f2f706f7365722e707567782e6f72672f6d796b65686f77656c6c732f646f74656e762f762f756e737461626c652e737667)](https://packagist.org/packages/mykehowells/dotenv)

If you have used Laravel and gotten used to being able to set and switch between environments as easily as swapping out a .env file.

Using `mykehowells/dotenv`, you can now add that functionality to your own projects with composer.

Install via Composer
--------------------

[](#install-via-composer)

Add mykehowells/dotenv to your project via composer with the following line:

`composer require mykehowells/dotenv`

Add the below code to check for a .env file, and import if it exists. Preferably, you should store this file outside of any publicly accessible directories, as it will contain potentially sensitive data - such as database credentials.

Check out the `vlucas/phpdotenv` [readme](https://github.com/vlucas/phpdotenv/blob/master/README.md) for more info on that package.

```
/*----------------------------------------------------------------------------
| ENV CONFIGURATION
|-----------------------------------------------------------------------------
|
| Check to see if an env file exists at project root, if it does, import
| keys and values into putenv( $setting ), otherwise env( $key, $default=null )
| will return default value.
|
|---------------------------------------------------------------------------*/
load_env( __DIR__ );
```

You can then start using the `env( $key, $default = null )` function to retrieve data from your .env file.

###  Health Score

31

—

LowBetter than 66% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity22

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity61

Established project with proven stability

 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 ~101 days

Total

4

Last Release

3464d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/494de8188ad97403b72e40e385235a74ef6331aa2710b3727193f646189af9fc?d=identicon)[mykemeynell](/maintainers/mykemeynell)

---

Top Contributors

[![mykemeynell](https://avatars.githubusercontent.com/u/1590190?v=4)](https://github.com/mykemeynell "mykemeynell (2 commits)")

---

Tags

phplaraveldotenvironmentdevelopmentenvdotenvproduction

### Embed Badge

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

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

PHPackages © 2026

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