PHPackages                             deinternetjongens/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. deinternetjongens/env

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

deinternetjongens/env
=====================

Simple library to consume environment variables

v1.0.2(10y ago)015.1k1MITPHPPHP &gt;=5.2

Since Dec 30Pushed 10y ago1 watchersCompare

[ Source](https://github.com/Bartjuh4/env)[ Packagist](https://packagist.org/packages/deinternetjongens/env)[ RSS](/packages/deinternetjongens-env/feed)WikiDiscussions master Synced 4w ago

READMEChangelogDependenciesVersions (4)Used By (0)

env
===

[](#env)

[![Build Status](https://camo.githubusercontent.com/b23bc8ad9e1e267da83d2b69696b91fedb194805c30518882e42710debfbb2f1/68747470733a2f2f7472617669732d63692e6f72672f6f736361726f7465726f2f707372372d6d6964646c6577617265732e737667)](https://travis-ci.org/oscarotero/psr7-middlewares)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/23525fc2185e4b228a75b13b303baa3f12af1c223750159a602698bd92d5b83e/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6f736361726f7465726f2f656e762f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/oscarotero/env/?branch=master)

Simple library to get environment variables converted to simple types.

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

[](#installation)

This package is installable and autoloadable via Composer as [oscarotero/env](https://packagist.org/packages/oscarotero/env).

```
$ composer require deinternetjongens/env

```

Example
-------

[](#example)

```
// Using getenv function:
var_dump(getenv('FOO')); //string(5) "false"

// Using Env:
var_dump(Env::get('FOO')); //bool(false)
```

Available conversions:
----------------------

[](#available-conversions)

- "false" is converted to boolean `false`
- "true" is converted to boolean `true`
- "null" is converted to `null`
- If the string contains only numbers is converted to an integer
- If the string has quotes, remove them

To configure the conversion, you can use the following constants (all enabled by default):

- `Env::CONVERT_BOOL` To convert boolean values
- `Env::CONVERT_NULL` To convert null values
- `Env::CONVERT_INT` To convert integer values
- `Env::STRIP_QUOTES` To remove the quotes of the strings

```
//Convert booleans and null, but not integers or strip quotes
Env::$options = Env::CONVERT_BOOL | Env::CONVERT_NULL;
```

Default value
-------------

[](#default-value)

By default, if the value does not exits, returns `null`, but you can change for any other value:

```
Env::$default = false;
```

The env() function
------------------

[](#the-env-function)

If you don't want to complicate with classes and namespaces, you can use the `env()` function, like in Laravel or other libraries:

```
Env::init(); //expose the function to globals

//now you can use it

var_dump(env('FOO'));
```

###  Health Score

30

—

LowBetter than 61% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity20

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity60

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

Every ~63 days

Total

3

Last Release

3748d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/3957548?v=4)[Daniel](/maintainers/DIJ)[@DIJ](https://github.com/DIJ)

---

Top Contributors

[![oscarotero](https://avatars.githubusercontent.com/u/377873?v=4)](https://github.com/oscarotero "oscarotero (10 commits)")

---

Tags

env

### Embed Badge

![Health badge](/badges/deinternetjongens-env/health.svg)

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

###  Alternatives

[vlucas/phpdotenv

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

13.5k654.3M6.7k](/packages/vlucas-phpdotenv)[symfony/dotenv

Registers environment variables from a .env file

3.8k249.2M3.0k](/packages/symfony-dotenv)[helhum/dotenv-connector

Makes it possible to set environment variables for composer projects.

1595.0M42](/packages/helhum-dotenv-connector)[oscarotero/env

Simple library to consume environment variables

9612.2M168](/packages/oscarotero-env)[ffraenz/private-composer-installer

A composer install helper for private packages

2341.8M5](/packages/ffraenz-private-composer-installer)[m1/env

Env is a lightweight library bringing .env file parser compatibility to PHP. In short - it enables you to read .env files with PHP.

6413.0M25](/packages/m1-env)

PHPackages © 2026

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