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(3y ago)064MITPHP

Since Apr 8Pushed 3y ago1 watchersCompare

[ Source](https://github.com/nazares/phpdotenv)[ Packagist](https://packagist.org/packages/nazares/phpdotenv)[ RSS](/packages/nazares-phpdotenv/feed)WikiDiscussions main Synced 2w 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 25% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity48

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

1149d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1632834?v=4)[Sergei Nazarenko](/maintainers/nazares)[@nazares](https://github.com/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)
```

###  Alternatives

[alfallouji/php_multithread

iPHP library to handle multi-threading

3231.0k](/packages/alfallouji-php-multithread)[heimrichhannot/contao-encore-bundle

This bundle brings deep integration for symfony encore into contao. On the one hand, your can prepare your bundles to define own webpack entries, which added with just one command to your webpack entries. On the other hand, this bundle allows you to add encore entries only on the pages you need them for optimizing your website performance.

1016.8k](/packages/heimrichhannot-contao-encore-bundle)

PHPackages © 2026

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