PHPackages                             neemzy/environ - 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. neemzy/environ

ActiveLibrary

neemzy/environ
==============

Lightweight environment manager

1.0.0(10y ago)41881[1 PRs](https://github.com/neemzy/environ/pulls)1PHPPHP &gt;=5.3.0

Since Feb 18Pushed 10y ago1 watchersCompare

[ Source](https://github.com/neemzy/environ)[ Packagist](https://packagist.org/packages/neemzy/environ)[ RSS](/packages/neemzy-environ/feed)WikiDiscussions master Synced 2d ago

READMEChangelogDependenciesVersions (2)Used By (1)

ENVIRON
=======

[](#environ)

Lightweight environment manager

HOW TO USE IT
-------------

[](#how-to-use-it)

### 1. Instantiate

[](#1-instantiate)

```
$environ = new Neemzy\Environ\Manager();
```

### 2. Add environments

[](#2-add-environments)

When adding an environment, you have to specify :

- A name
- A condition closure
- A callback closure

```
$environ
    ->add(
        'dev',
        new Neemzy\Environ\Environment(
            function () {
                return preg_match('/localhost/', $_SERVER['SERVER_NAME']);
            },
            function () {
                $pdo = new PDO('sqlite:dev.db');
            }
        )
    )
    ->add(
        'prod',
        new Neemzy\Environ\Environment(
            function () {
                return true;
            },
            function () {
                $pdo = new PDO('mysql:host=MYHOST;dbname=MYDBNAME', 'MYUSER', 'MYPASSWORD');
            }
        )
    );
```

You can chain declarations as above.

### 3. ???

[](#3-)

```
$environ->init();
```

This will browse the environments you declared above. The first one which condition closure returns a truthy value is then set up as the current environment, and its callback closure is triggered.

### 4. Profit !

[](#4-profit-)

Let's assume you're on localhost.

```
// This will print 'dev'
echo($environ->get());

// Triggers the callback as well
$environ->set('prod');

if ($environ->is('prod')) {
    // There you go !
}
```

###  Health Score

29

—

LowBetter than 60% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 85.7% 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

3737d ago

### Community

Maintainers

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

---

Top Contributors

[![neemzy](https://avatars.githubusercontent.com/u/1804389?v=4)](https://github.com/neemzy "neemzy (18 commits)")[![bpolaszek](https://avatars.githubusercontent.com/u/5569077?v=4)](https://github.com/bpolaszek "bpolaszek (3 commits)")

### Embed Badge

![Health badge](/badges/neemzy-environ/health.svg)

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

PHPackages © 2026

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