PHPackages                             nazares/phpdotenv - 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. nazares/phpdotenv

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

nazares/phpdotenv
=================

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

v1.0.3(2y ago)064MITPHP

Since Apr 8Pushed 2y ago1 watchersCompare

[ Source](https://github.com/nazares/phpdotenv)[ Packagist](https://packagist.org/packages/nazares/phpdotenv)[ RSS](/packages/nazares-phpdotenv/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (3)DependenciesVersions (4)Used By (0)

PHP Dotenv
==========

[](#php-dotenv)

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

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

[](#installation)

```
composer require nazares/phpdotenv
```

Usage
-----

[](#usage)

`.env` file

```
DB_HOST =localhost
DB_NAME = test
DB_PASSWORD= secret
```

```
$dotenv = new \nazares\phpdotenv\Dotenv($path);
$dotenv->load();

echo getenv('DB_HOST'); // localhost
echo $_ENV['DB_NAME']; // test
echo $_SERVER['DB_PASSWORD']; // secret
```

or

```
(new \nazares\phpdotenv\Dotenv($path))->load();

echo getenv('DB_HOST'); // localhost
echo $_ENV['DB_NAME']; // test
echo $_SERVER['DB_PASSWORD']; // secret
```

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity47

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

Total

3

Last Release

1059d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/9f84edc7bb0390b0f590d384497e592f36236ce372d9ae2b356265799a7190a1?d=identicon)[nazares](/maintainers/nazares)

---

Top Contributors

[![nazares](https://avatars.githubusercontent.com/u/1632834?v=4)](https://github.com/nazares "nazares (5 commits)")

### Embed Badge

![Health badge](/badges/nazares-phpdotenv/health.svg)

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

PHPackages © 2026

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