PHPackages                             into-the-void/env - 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. into-the-void/env

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

into-the-void/env
=================

Read, parse and modify environment variables

1.0(2y ago)025MITPHPPHP ^7.1 || ^8.0

Since Dec 7Pushed 2y ago1 watchersCompare

[ Source](https://github.com/into-the-v0id/env.php)[ Packagist](https://packagist.org/packages/into-the-void/env)[ Docs](https://github.com/into-the-v0id/env.php)[ RSS](/packages/into-the-void-env/feed)WikiDiscussions main Synced yesterday

READMEChangelog (2)Dependencies (4)Versions (4)Used By (0)

Env
===

[](#env)

[![Latest Packagist Version](https://camo.githubusercontent.com/c907384ab437fe80ed7f178a81f5bc8ed41be40146ea523531c11f2b796fe66c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f696e746f2d7468652d766f69642f656e76)](https://camo.githubusercontent.com/c907384ab437fe80ed7f178a81f5bc8ed41be40146ea523531c11f2b796fe66c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f696e746f2d7468652d766f69642f656e76)[![Latest Packagist License](https://camo.githubusercontent.com/26fc5f3f3cfecbbf230a18342b34133017569d3ac297d0f680c7b0397bfb6619/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f696e746f2d7468652d766f69642f656e76)](https://camo.githubusercontent.com/26fc5f3f3cfecbbf230a18342b34133017569d3ac297d0f680c7b0397bfb6619/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f696e746f2d7468652d766f69642f656e76)

Read, parse and modify environment variables

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

[](#installation)

You can install this library via [composer](https://getcomposer.org/):

```
composer require into-the-void/env
```

Example
-------

[](#example)

```
use IntoTheVoid\Env\Env;

getenv('APP_DEBUG');   // string(4) "true"
Env::get('APP_DEBUG'); // bool(true)

getenv('DB_PORT');     // string(4) "5432"
Env::get('DB_PORT');   // int(5432)

Env::getString('DB_HOST'); // string(9) "localhost"
Env::getBool('APP_DEBUG'); // bool(true)
Env::getInt('DB_PORT');    // int(5432)
Env::getFloat('APP_MUL');  // double(1.25)
Env::getList('PATH', ':'); // array(2) { "/usr/local/bin", "/usr/bin" }

Env::has('DB_PORT');       // bool(true)
Env::set('DB_PORT', 3306);
Env::remove('DB_PORT');
```

You may also use the helper function instead of calling `Env::get()`:

```
use function IntoTheVoid\Env\env;

env('APP_DEBUG'); // bool(true)
```

Behaviour
---------

[](#behaviour)

```
Env::getBool('NO_SUCH_VAR');         // NULL
Env::getRequiredBool('NO_SUCH_VAR'); // Fatal error: MissingEnvironmentVariable

Env::getBool('NOT_A_BOOL');                // Fatal error: UnparsableValue
Env::getBool('NOT_A_BOOL', strict: false); // NULL
```

### Repository

[](#repository)

By default, environment variables are read via `getenv(local_only: true)` and `getenv()`. They are written via `putenv()`, `$_ENV` and `$_SERVER`.

You may change this behaviour using `Env::setRepository()`. Have a look at [src/Repository](./src/Repository) for available Repositories.

### Normalizer

[](#normalizer)

If you want to strip spaces or quotes from your environment variables, then you may configure this via `Env::setNormalizer()`. Have a look at [src/Normalizer](./src/Normalizer) for available Normalizers.

This is not done by default, because your environment variables should not contain any unwanted spaces or quotes. If they do you probably should fix the declaration of those environment variables instead.

### Parser

[](#parser)

**Nullish values** (case insensitive): `''`, `'null'`, `'nil'`, `'none'`, `'undefined'`, `'empty'`
**Truthy values** (case insensitive): `'1'`, `'true'`, `'y'`, `'yes'`, `'on'`
**Falsy values** (case insensitive): `'0'`, `'false'`, `'n'`, `'no'`, `'off'`

License
-------

[](#license)

Copyright (C) Oliver Amann

This project is licensed under the MIT License (MIT). Please see [LICENSE](./LICENSE) for more information.

###  Health Score

23

—

LowBetter than 26% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity50

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

Total

2

Last Release

927d ago

Major Versions

0.1 → 1.02023-12-19

### Community

Maintainers

![](https://www.gravatar.com/avatar/ec406604ca9050225a0f595eb23a3acd09624f3e3b2c0c506066884093eacdaf?d=identicon)[into-the-void](/maintainers/into-the-void)

---

Top Contributors

[![into-the-v0id](https://avatars.githubusercontent.com/u/57257404?v=4)](https://github.com/into-the-v0id "into-the-v0id (14 commits)")

---

Tags

helperconvertprocessenvironmentparsereadwritevariablemodify

###  Code Quality

TestsPHPUnit

Static AnalysisPsalm

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/into-the-void-env/health.svg)

```
[![Health](https://phpackages.com/badges/into-the-void-env/health.svg)](https://phpackages.com/packages/into-the-void-env)
```

###  Alternatives

[vlucas/phpdotenv

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

13.5k640.2M6.3k](/packages/vlucas-phpdotenv)[barryvdh/laravel-ide-helper

Laravel IDE Helper, generates correct PHPDocs for all Facade classes, to improve auto-completion.

14.9k132.8M891](/packages/barryvdh-laravel-ide-helper)[league/csv

CSV data manipulation made easy in PHP

3.5k182.1M861](/packages/league-csv)[symfony/dotenv

Registers environment variables from a .env file

3.8k243.3M2.8k](/packages/symfony-dotenv)[react/child-process

Event-driven library for executing child processes with ReactPHP.

34691.0M159](/packages/react-child-process)[gabrielelana/byte-units

Library to parse, format and convert byte units

1752.3M21](/packages/gabrielelana-byte-units)

PHPackages © 2026

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