PHPackages                             honklegion/environment - 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. honklegion/environment

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

honklegion/environment
======================

Simple class for getting environment in proper type with fallback

v2.0.0(1y ago)0827↑50%MITPHPPHP &gt;= 8.0 &lt; 9.0

Since Aug 1Pushed 1y ago1 watchersCompare

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

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

HonkLegion/Environment
======================

[](#honklegionenvironment)

Easy class for getting ENV values with casting and default value fallback. Great for frameworks like Nette.

[![Coverage Status](https://camo.githubusercontent.com/d41848dd6f8b85022fd22379da9ac8a4c9384b762419af40478854853d72da5a/68747470733a2f2f696d672e736869656c64732e696f2f636f766572616c6c732f6769746875622f62636b702f656e7669726f6e6d656e742f6d6173746572)](https://coveralls.io/github/bckp/environment?branch=master)[![Tests](https://github.com/bckp/environment/actions/workflows/tests.yml/badge.svg)](https://github.com/bckp/environment/actions/workflows/tests.yml)[![Downloads this Month](https://camo.githubusercontent.com/8f2275fc21ac78f2a89d602024268a8bc53c765c120c7bb9fda10aaffbb81856/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646d2f62636b702f656e7669726f6e6d656e742e737667)](https://packagist.org/packages/bckp/environment)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/7f1c6dd162f20e09af0abfa596daa891e6411c8f473292916b8e8a1042704e9c/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f7175616c6974792f672f62636b702f656e7669726f6e6d656e742f6d6173746572)](https://scrutinizer-ci.com/g/bckp/environment/?branch=master)[![Latest stable](https://camo.githubusercontent.com/e7ca696d9d4597b6238994a882d93d018b5586f574c83602d0f935f1fefcb86f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f62636b702f656e7669726f6e6d656e742e737667)](https://packagist.org/packages/bckp/environment)[![License](https://camo.githubusercontent.com/7013272bd27ece47364536a221edb554cd69683b68a46fc0ee96881174c4214c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75652e737667)](https://github.com/bckp/environment/blob/master/license.md)

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

[](#installation)

The best way to install `honklegion/environment` is using [Composer](http://getcomposer.org/):

```
$ composer require honklegion/environment
```

Example
-------

[](#example)

imagine, you have set your ENV as follows:

```
FOO=false
BAR=1
KEYS=1|2|3
```

Lets see PHP code

```
use HonkLegion\Environment;

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

// Using Environment function:
var_dump(Environment::Bool('foo')); //bool(false)

// But we can go even further:
var_dump(Environment::Bool('BAR')); //bool(true)
var_dump(Environment::Float('BAR')); //float(1.0)

// What about multi-values?
var_dump(Environment::array('KEYS', '|', Environment::String)); //array(3) [0 => '1', 1 => '2', 2 => '3'] - notice we have strings
var_dump(Environment::array('KEYS', '|', Environment::Int)); //array(3) [0 => 1, 1 => 2, 2 => 3] - notice we have int

// Default values? No problem!
var_dump(Environment::Bool('prod', true)); //bool(true) * even bin is not set
```

Development
-----------

[](#development)

This package is currently maintaining by these authors.

[![](https://avatars.githubusercontent.com/u/208159255?s=80&v=4)](https://github.com/HonkLegion)

###  Health Score

37

—

LowBetter than 83% of packages

Maintenance47

Moderate activity, may be stable

Popularity17

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity62

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

Total

2

Last Release

390d ago

Major Versions

v1.0 → v2.0.02025-04-23

PHP version history (2 changes)v1.0PHP &gt;= 8.0

v2.0.0PHP &gt;= 8.0 &lt; 9.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/179652?v=4)[Radovan Kepák](/maintainers/bckp)[@bckp](https://github.com/bckp)

---

Top Contributors

[![bckp](https://avatars.githubusercontent.com/u/179652?v=4)](https://github.com/bckp "bckp (18 commits)")

###  Code Quality

Static AnalysisPHPStan, Psalm

Type Coverage Yes

### Embed Badge

![Health badge](/badges/honklegion-environment/health.svg)

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

PHPackages © 2026

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