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

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

tristankechlo/simple-dotenv
===========================

simple library to parse .env files

1.0.0(1y ago)023MITPHPPHP &gt;=8.0

Since Aug 20Pushed 1y ago1 watchersCompare

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

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

Simple Dotenv Parser
====================

[](#simple-dotenv-parser)

small parser for .env files

normal parsing
==============

[](#normal-parsing)

```
# .env file
KEY1="This is a string"
KEY2=234
KEY3=4.5
KEY4=TRUE
KEY5=OFF
```

```
# php file
use TK\Dotenv\Dotenv;

$content = file_get_contents("./.env");
$actual = Dotenv::parse($content);
```

```
# output
$actual = [
    "KEY1" => "This is a string",
    "KEY2" => "234",
    "KEY3" => "4.5",
    "KEY4" => "TRUE",
    "KEY5" => "OFF",
];
```

parsing with conversion
=======================

[](#parsing-with-conversion)

```
# .env file
KEY1="This is a string"
KEY2=234
KEY3=4.5
KEY4=TRUE
KEY5=OFF
```

```
# php file
use TK\Dotenv\Dotenv;

$content = file_get_contents("./.env");
$actual = Dotenv::parse($content, true);
```

```
# output
$actual = [
    "KEY1" => "This is a string",
    "KEY2" => 234,
    "KEY3" => 4.5,
    "KEY4" => true,
    "KEY5" => false,
];
```

conversion
----------

[](#conversion)

The parse can convert some values to php primitive types, otherwise all values are string.

### booleans

[](#booleans)

these values will be converted to booleans (case insensitive):

- truthy\_values = \['true', 'yes', 'on'\]
- falsy\_values = \['false', 'no', 'off'\]

### numbers

[](#numbers)

these values will be converted to numbers:

- integers (e.g. `3` or `23424`)
- floats (e.g. `5.76` or `43234.3453`)
- hexadezimal *only with prefix `0x`* (e.g. `0xa0` to `160`)
- binary *only with prefix `0b`* (e.g. `0b110011` to `51`)
- octal *only with prefix `0o`* (e.g. `0o77` to `63`)

### null

[](#null)

these values will be converted to `null` (case insensitive):

- null
- none

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance36

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity44

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

Unknown

Total

1

Last Release

626d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/a56e00f35b73379f4bf262cc4c2e9f9c95c1aa27ad2ee9b89e5126254dcd8b19?d=identicon)[tristankechlo](/maintainers/tristankechlo)

---

Top Contributors

[![tristankechlo](https://avatars.githubusercontent.com/u/66692834?v=4)](https://github.com/tristankechlo "tristankechlo (3 commits)")

---

Tags

dotenv-parserphpphp-library

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[vmwarephp/vmwarephp

Vmware vSphere bindings for PHP

7818.8k](/packages/vmwarephp-vmwarephp)[orrison/cumulus

Import DNS records from Laravel Vapor into Cloudflare

3817.1k](/packages/orrison-cumulus)[friends-of-hyva/magento2-crawler-session

Prevent crawlers from creating a session

155.8k](/packages/friends-of-hyva-magento2-crawler-session)

PHPackages © 2026

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