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

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

neonxp/dotenv
=============

Advanced loading and parsing .env file in PHP-7

0.0.1(8y ago)010MITPHPPHP &gt;=7.0

Since Jan 19Pushed 8y ago1 watchersCompare

[ Source](https://github.com/NeonXP/Dotenv)[ Packagist](https://packagist.org/packages/neonxp/dotenv)[ RSS](/packages/neonxp-dotenv/feed)WikiDiscussions master Synced 3d ago

READMEChangelogDependencies (1)Versions (2)Used By (0)

Dotenv
======

[](#dotenv)

[![Build Status](https://camo.githubusercontent.com/bbf2fe5ec5a0988a5a5f4eb9adbd9cbfffd512c22af1e08c8098d15d2e169b8c/68747470733a2f2f7472617669732d63692e6f72672f4e656f6e58502f446f74656e762e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/NeonXP/Dotenv)[![Codecov](https://camo.githubusercontent.com/3668c4216fb0a09b143feb8ebd4ca5243d0496b1dc880e87489ff6726cf7efae/68747470733a2f2f696d672e736869656c64732e696f2f636f6465636f762f632f6769746875622f6e656f6e78702f646f74656e762e737667)](https://codecov.io/gh/NeonXP/Dotenv)[![GitHub issues](https://camo.githubusercontent.com/b5fc5404b27df1fbddbb16fff7fb99232e07b80f4e7a6f8e9c8556a16c2c5ec2/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6973737565732f6e656f6e78702f646f74656e762e737667)](https://github.com/neonxp/dotenv/issues)[![GitHub forks](https://camo.githubusercontent.com/1718caef25aa73b5b06f9e1e18344a22d1d3e6a0381a6ee254fa3440f96e32d1/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f666f726b732f6e656f6e78702f646f74656e762e737667)](https://github.com/neonxp/dotenv/network)[![GitHub stars](https://camo.githubusercontent.com/3a7ba3fb4f65a310396fbb50446ff508b6cdb4467fd7cdb6e6ae39fb3a28b251/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73746172732f6e656f6e78702f646f74656e762e737667)](https://github.com/neonxp/dotenv/stargazers)[![GitHub license](https://camo.githubusercontent.com/acf58716cb1f7fb2f9b6557c180a795ee60f4a55957b9efa3a55334c61cb6bcb/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f6e656f6e78702f646f74656e762e737667)](https://github.com/neonxp/dotenv)

What is it?
-----------

[](#what-is-it)

Small library, that automaticaly loads `.env` (or any other) file to applications environment.

Why not XXX?
------------

[](#why-not-xxx)

Because this library is pretty simple, without external dependencies and highly customizable.

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

[](#installation)

```
composer require neonxp/dotenv

```

Usage
-----

[](#usage)

Basic usage:

```
use NeonXP\Dotenv\Dotenv;

$dotenv = new Dotenv();
$dotenv->load(); // You can specify file to load at first argument

print $dotenv->get('KEY', 'default') . PHP_EOL;
print $dotenv['KEY'] . PHP_EOL;
foreach ($dotenv as $key => $value) {
    print "$key = $value" . PHP_EOL;
}
```

.env file syntax
----------------

[](#env-file-syntax)

Here examples of syntax:

```
# This is a comment

# Empty lines also ignored
export KEY1=VALUE1
KEY2 = VALUE2 # Inline comment
KEY3 = 'VALUE3 # This is not comment'
KEY4 = "VALUE4 # And this value too"
KEY5 = ${KEY1} -> ${KEY2} # Compilled from another variables

```

and we will get:

```
[
    'KEY1' => 'VALUE1',
    'KEY2' => 'VALUE2',
    'KEY3' => 'VALUE3 # This is not comment',
    'KEY4' => 'VALUE4 # And this value too',
    'KEY5' => 'VALUE1 -> VALUE2',
]
```

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity48

Maturing project, gaining track record

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

Unknown

Total

1

Last Release

3038d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/7bff91e9bc8601ba57f9d79fb3d5db7c09fe3b03cbec0f33acc6a9a1ecfb1492?d=identicon)[NeonXP](/maintainers/NeonXP)

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[rymanalu/factory-generator

Laravel 5 Model Factory Generator.

178.0k](/packages/rymanalu-factory-generator)

PHPackages © 2026

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