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

AbandonedArchivedLibrary

fewagency/env
=============

Consumer for .env files in PHP

v1.0(9y ago)0101[2 issues](https://github.com/bjuppa/env/issues)MITPHPPHP ~5.6|~7.0

Since Nov 24Pushed 8y ago3 watchersCompare

[ Source](https://github.com/bjuppa/env)[ Packagist](https://packagist.org/packages/fewagency/env)[ Docs](https://github.com/fewagency/env)[ RSS](/packages/fewagency-env/feed)WikiDiscussions master Synced 2mo ago

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

Consumer for .env files in PHP
==============================

[](#consumer-for-env-files-in-php)

You want to use [`vlucas/phpdotenv`](https://github.com/vlucas/phpdotenv) but also need an `env()` helper function? This is the package you're looking for.

Install
-------

[](#install)

Via Composer

```
$ composer require fewagency/env
```

Usage
-----

[](#usage)

Add a `.env` file to the root of your project. Read more about that [at `vlucas/phpdotenv`](https://github.com/vlucas/phpdotenv).

Require the Composer autoloader - if not already included by your framework

```
require_once __DIR__.'/../vendor/autoload.php';
```

Load the `.env` file and make the `env()` function global. If `.env` is not in your project root directory, you can specify a path to the directory as a parameter to `init()`.

```
\Fewagency\Env\Env::init();
```

Then use the `env()` function to pull out environment variables with an (optional) default value.

```
$db_user = env('DB_USER', 'default_db_user');
```

Inspiration
-----------

[](#inspiration)

We came across this package that did almost what we wanted to but not quite:

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

[](#development)

Run `composer create-project` to create the test `.env` from `.env.example`.

### Run tests

[](#run-tests)

```
$ composer test
```

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity58

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

Unknown

Total

1

Last Release

3460d ago

### Community

Maintainers

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

---

Top Contributors

[![bjuppa](https://avatars.githubusercontent.com/u/5339269?v=4)](https://github.com/bjuppa "bjuppa (1 commits)")

---

Tags

dot-environmentenvdotenv

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

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

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

###  Alternatives

[bnomei/kirby3-dotenv

Kirby Plugin for environment variables from .env

4144.1k1](/packages/bnomei-kirby3-dotenv)[beebmx/kirby-env

Enable env variables to Kirby

2037.9k2](/packages/beebmx-kirby-env)[nystudio107/dotenvy

Speed up your production sites by ditching .env for key/value variable pairs as Apache, Nginx, and shell equivalents.

326.9k](/packages/nystudio107-dotenvy)[johannschopplich/kirby-helpers

Environment, SEO, and build utilities for Kirby CMS

277.4k](/packages/johannschopplich-kirby-helpers)

PHPackages © 2026

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