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

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

tnapf/env
=========

A environment package for PHP

v1.2.1(2y ago)095213MITPHPPHP &gt;=8.1

Since May 22Pushed 2y ago1 watchersCompare

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

READMEChangelog (4)Dependencies (7)Versions (5)Used By (3)

Tnapf/Env
=========

[](#tnapfenv)

A package for handling environment variables in a simple way.

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

[](#installation)

```
composer require tnapf/env
```

Usage
-----

[](#usage)

### Creating without .env

[](#creating-without-env)

```
use Tnapf\Env\Env;

$env = new Env();

$env->devMode = true;

// or

$env['devMode'] = true;

####################################
#   Somewhere else in the script   #
####################################

Env::get()->devMode; // true

// or

Env::get()['devMode']; // true
```

### Creating with .env file

[](#creating-with-env-file)

```
use Tnapf\Env\Env;

$env = Env::createFromFile(__DIR__ . '/.env');
```

### Creating with string .env

[](#creating-with-string-env)

```
use Tnapf\Env\Env;

$env = Env::createFromString('devMode=true');
```

Getting autocomplete
--------------------

[](#getting-autocomplete)

Create a class that extends Tnapf\\Env and add PHP DocBlocks for the properties.

```
use Tnapf\Env\Env as TnapfEnv;

/**
 * @property bool $devMode
 * @property string $databaseHost
 * @property string $databaseUser
 * @property string $databasePassword
 * @property string $databaseName
 */
class Env extends TnapfEnv
{
}
```

Then use this class instead of `Tnapf\Env\Env`

###  Health Score

29

—

LowBetter than 59% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity17

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 77.8% 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 ~13 days

Total

4

Last Release

1053d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/c1dc8515485fa64088fdfa03dd0f487d507dc1516824c31be2626a6ee25244dd?d=identicon)[command\_string](/maintainers/command_string)

---

Top Contributors

[![CommandString](https://avatars.githubusercontent.com/u/44886996?v=4)](https://github.com/CommandString "CommandString (21 commits)")[![xHeaven](https://avatars.githubusercontent.com/u/14284867?v=4)](https://github.com/xHeaven "xHeaven (6 commits)")

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

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

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

###  Alternatives

[jalle19/php-yui-compressor

A modern PHP wrapper for the YUI compressor

17972.2k3](/packages/jalle19-php-yui-compressor)

PHPackages © 2026

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