PHPackages                             jsefton/php-dotenv-parser - 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. [Parsing &amp; Serialization](/categories/parsing)
4. /
5. jsefton/php-dotenv-parser

ActiveLibrary[Parsing &amp; Serialization](/categories/parsing)

jsefton/php-dotenv-parser
=========================

Allows you get .env file as array and convert array back to .env file

1.0.0(8y ago)58.2k↓19.2%2[1 issues](https://github.com/jsefton/php-dotenv-parser/issues)MITPHP

Since Aug 7Pushed 8y ago1 watchersCompare

[ Source](https://github.com/jsefton/php-dotenv-parser)[ Packagist](https://packagist.org/packages/jsefton/php-dotenv-parser)[ Docs](https://github.com/jsefton/php-dotenv-parser)[ RSS](/packages/jsefton-php-dotenv-parser/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)DependenciesVersions (2)Used By (0)

PHP DotEnv Parser
-----------------

[](#php-dotenv-parser)

This easy tool allows you to pass a `.env` file and be returned a parsed array.

You can then add or edit values from this array.

This parser also allows you to pass an array and store as a valid `.env` file to be used.

### Installation

[](#installation)

You will need composer to install this package (get composer). Then run:

```
composer require jsefton/php-dotenv-parser
```

### Usage

[](#usage)

To parse a `.env` file to an array pass in the path like below:

```
$env = \Jsefton\DotEnv\Parser::envToArray('/path/to/.env');
```

To store an array into a `.env` file pass the array along with the path to store it:

```
\Jsefton\DotEnv\Parser::arrayToEnv($array, '/path/to/.env');
```

###  Health Score

33

—

LowBetter than 75% of packages

Maintenance16

Infrequent updates — may be unmaintained

Popularity30

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity63

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

Unknown

Total

1

Last Release

3206d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/41b413127c7499a63bcb5c5ae903bd8961ba29300b6ccbda873e0c4bf06d0a02?d=identicon)[jsefton](/maintainers/jsefton)

---

Top Contributors

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

---

Tags

dotenvdotenv-editordotenv-helperenvenvironment-variablesphpphpparserenvdotenvarray-env

### Embed Badge

![Health badge](/badges/jsefton-php-dotenv-parser/health.svg)

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

###  Alternatives

[doctrine/lexer

PHP Doctrine Lexer parser library that can be used in Top-Down, Recursive Descent Parsers.

11.2k910.8M118](/packages/doctrine-lexer)[simplehtmldom/simplehtmldom

A fast, simple and reliable HTML document parser for PHP.

1921.3M14](/packages/simplehtmldom-simplehtmldom)[corveda/php-sandbox

A PHP library that can be used to run PHP code in a sandboxed environment

23483.5k2](/packages/corveda-php-sandbox)[sbsaga/toon

🧠 TOON for Laravel — a compact, human-readable, and token-efficient data format for AI prompts &amp; LLM contexts. Perfect for ChatGPT, Gemini, Claude, Mistral, and OpenAI integrations (JSON ⇄ TOON).

6115.6k](/packages/sbsaga-toon)[leonelquinteros/php-toml

PHP parser for TOML language ( https://github.com/toml-lang/toml )

266.7k](/packages/leonelquinteros-php-toml)

PHPackages © 2026

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