PHPackages                             envhandler/envhandler - 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. envhandler/envhandler

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

envhandler/envhandler
=====================

Simple and minimal yet powerful env handler

v1.0(5y ago)016PHP

Since Dec 22Pushed 5y ago1 watchersCompare

[ Source](https://github.com/matthewobisnar/envHandler)[ Packagist](https://packagist.org/packages/envhandler/envhandler)[ RSS](/packages/envhandler-envhandler/feed)WikiDiscussions main Synced 4d ago

READMEChangelogDependenciesVersions (2)Used By (0)

Installation
============

[](#installation)

To install with composer:

```
composer require envhandler/envhandler

```

Env Sample Format
=================

[](#env-sample-format)

```
APP_NAME=null
APP_URL=http://localhost
APP_ENV=development

DB_CONNECTIONS=pdo
DB_USERNAME=dumpy_username
DB_PASSWORD=dumpy_password
DB_NAME=dump_dbname
DB_HOST=localhost
DB_PORT=8080

MAILER=PHPMailer
MAIL_MAILER=null
MAIL_HOST=null
MAIL_PORT=null
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
MAIL_FROM_ADDRESS=null
MAIL_FROM_NAME=null
```

You can Create your own key=value pair in .env.

```
CUSTOM_KEY=VALUE
```

Usage
=====

[](#usage)

```
require __DIR__ ."/vendor/autoload.php";

// The class the will automatically creates the env.example file during instantiation.

$env = new \EnvHandler\Environment\Environment(__DIR__);
```

```
// true parameter will automatically creates the .env at the root path of your project with the value from .env.example

$env->load(true);
```

```
// To manually create an env file, call the load method with an empty parameter.
// And create the .env file at the root path of your project with key=value format.

$env->load();
```

```
// Output an associative array value from .env file.

var_dump($env->getEnvFileContent());
```

Sample Output
=============

[](#sample-output)

Call the value you stored in .env anywhere in your project.

```
echo getEnv('APP_URL'); // Output: http://localhost
echo getEnv('APP_NAME'); // Output: App Name
echo getEnv('APP_ENV'); // Output: development

echo getEnv('YOUR_CUSTOM_KEY_HERE_FROM_ENV')
```

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity53

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

1970d ago

### Community

Maintainers

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

---

Top Contributors

[![matthewobisnar](https://avatars.githubusercontent.com/u/33310242?v=4)](https://github.com/matthewobisnar "matthewobisnar (41 commits)")

---

Tags

envEnv HandlerEnvHandler

### Embed Badge

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

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

###  Alternatives

[vlucas/phpdotenv

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

13.5k602.4M5.4k](/packages/vlucas-phpdotenv)[symfony/dotenv

Registers environment variables from a .env file

3.8k226.7M2.3k](/packages/symfony-dotenv)[helhum/dotenv-connector

Makes it possible to set environment variables for composer projects.

1594.6M34](/packages/helhum-dotenv-connector)[oscarotero/env

Simple library to consume environment variables

9411.4M152](/packages/oscarotero-env)[ffraenz/private-composer-installer

A composer install helper for private packages

2331.7M5](/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.

6412.0M21](/packages/m1-env)

PHPackages © 2026

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