PHPackages                             codervio/envmanager - 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. [Framework](/categories/framework)
4. /
5. codervio/envmanager

ActiveLibrary[Framework](/categories/framework)

codervio/envmanager
===================

Codervio Environment manager

1.7(8y ago)01312MITPHPPHP ^7.0

Since Feb 22Pushed 7y ago1 watchersCompare

[ Source](https://github.com/Codervio/Envmanager)[ Packagist](https://packagist.org/packages/codervio/envmanager)[ Docs](http://codervio.com)[ RSS](/packages/codervio-envmanager/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (9)Dependencies (1)Versions (10)Used By (0)

Environment manager
===================

[](#environment-manager)

[![Join the chat at https://gitter.im/Codervio/Envmanager](https://camo.githubusercontent.com/3ab297cbf2bc5c89b41e9dfba6ab4d065e6bd5eb92ef6fd1672d0a4a231d23ef/68747470733a2f2f6261646765732e6769747465722e696d2f436f64657276696f2f456e766d616e616765722e737667)](https://gitter.im/Codervio/Envmanager?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)

[![Latest Version on Packagist](https://camo.githubusercontent.com/4833a7bd21f1ae5c2265e86a63f08b563d5119b7b9f2e0dc7a63a54d8df38e26/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f636f64657276696f2f656e766d616e616765722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/codervio/envmanager)[![Build Status](https://camo.githubusercontent.com/e8a1f287198036b4d5d73d2a8010a5e8fb514195821ee691c328e485004f9fb1/68747470733a2f2f7472617669732d63692e6f72672f436f64657276696f2f456e766d616e616765722e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/Codervio/Envmanager)[![Total Downloads](https://camo.githubusercontent.com/cb999ac10a3bf433755ca87f0b1c2e81200d06eccab208ee3c424ee421bbf077/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f636f64657276696f2f656e766d616e616765722e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/Codervio/Envmanager/?branch=master)

The `Environment manager` parses, populates dot environment variables from env files to super global $\_ENV variable, apache and getenv function. It supports for checking variables and fetching system only variables.

It provides for editing environment file and manipulate them.

[![Screenshot](https://github.com/Codervio/Envmanager/raw/master/screenshot.png "Screenshot")](https://github.com/Codervio/Envmanager/raw/master/screenshot.png)

Donations
---------

[](#donations)

Due I am working 100% alone without any helps, organizations and any others team I can be satisfy for receiving any amount of payment to improve, develop and continue building on origin idea of framework.

You can pay any amount to PayPal: [https://www.paypal.me/codervio?locale.x=en\_US](https://www.paypal.me/codervio?locale.x=en_US)

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

[](#installation)

1. Installation via [Composer](http://www.composer.org) on [Packagist](https://packagist.org/packages/codervio/envmanager)
2. Installation using [Git](http://www.github.com) GIT clone component

Prerequisities
--------------

[](#prerequisities)

PHP version requirements: *PHP &gt;7.0*

PHP extension: *mbstring*

Use `use Codervio\Environment\EnvParser` declaration for parsing dot env files.

Use `use Codervio\Environment\EnvEditor` declaration for edit and manage dot env file.

A \[`requirements`\] - Requirements and auto detect encodings script automatically can check mbstring extension and automatically detects encoding types.

Usage
-----

[](#usage)

Example of fetching env variables and loading into global super variables like `$_ENV`, using function `getenv()` or directly using instance:

If on a file example.env contains a data:

```
FOO=bar

```

After loading instance it can be fetching a variable:

```
use Codervio\Envmanager\Envparser;

$envparser = new Envparser('.env');
$envparser->load();
$envparser->run();

$result = $parser->getValue('FOO');
var_dump($result);
```

Returns a result will automatically detect type of getting env variables:

```
(string) 'bar'
```

Or get a result using env variables globally:

```
    echo apache_getenv('FOO')
    echo getenv('FOO')
    echo $_ENV('FOO')
```

Returning a result
------------------

[](#returning-a-result)

A result returns in following orders:

- using apache\_getenv() if apache service is configured internally to use only Apache environment
- using getenv() that most Unix systems supports
- using PHP native super globals $\_ENV function

It will automatically parse to PHP env functions and super globals so you can access via:

- superglobals functions $\_ENV
- superglobals $\_SERVER variable
- using getenv() if is enabled by system
- using apache\_getenv() if is enabled by Apache service

Changelog
---------

[](#changelog)

Status of core:

VersionState`1.0`Release versionPHP version above `7.0`. Quality assurance: Unit tests provided

Table of Contents
-----------------

[](#table-of-contents)

### Envparser

[](#envparser)

#### Common env variables

[](#common-env-variables)

- For loading simple ENV variables use \[`example`\]

```
FOO=bar
VAREMPTY=
FOO1=foo1
WITHSPACES="with spaces"

```

#### Lists examples env variables

[](#lists-examples-env-variables)

- Lists of examples env variables: \[`lists`\]

#### Comments

[](#comments)

- Writing comments: \[`comments`\]

```
# comment
# a comment #comment
## A main comment ##
FOO=bar # a comment
```

#### Comments parsing as variable (dev only, not recommeded)

[](#comments-parsing-as-variable-dev-only-not-recommeded)

It is possible to parse comments variables such using:

```
 new Envparser('main.env', true);
```

A variable inside comment can be visible

```
 #COM1=BAR1
```

using command:

```
 $envparser->getAllValues(); # to get all values
 $envparser->getValue('#COM1'); # to get commented key
```

which returns as array and keeps # mark:

```
  ["#COM1"]=>
  string(4) "BAR1"
```

or directly:

```
 $envparser->getValue('#COM1');
```

will parsing a variable

```
  string(4) "BAR1"
```

#### Parsing apache env variables or unix exports env variables

[](#parsing-apache-env-variables-or-unix-exports-env-variables)

- Parsing export or setenv variables: \[`envexports`\]

```
setenv FOO1=value # general csh case
export FOO2=value
SetEnv FOO3=value # Apache camel case
```

#### Get a system only variables

[](#get-a-system-only-variables)

It is possible to fetch all system variables:

```
use Codervio\Envmanager\Envparser;

$envparser = new Envparser();
$envparser->load();
$envparser->run();

var_dump($envparser->getSystemVars());
```

- For fetching single variable or just check a variable exists see \[`getSystemVars`\] and \[`checkSystemVar()`\].
- See validation types for values in environment variables: \[`required()`\]
- To fetch a comment from a file of specific variable use: \[`getComment()`\]

#### References

[](#references)

- \[`requirements`\] - Requirements and auto detect encodings
- \[`setEncoding()`\] - Manually specify encoding
- \[`getEncoding()`\] - Detect encoding type from file
- \[`checkSuperGlobalsSet()`\] - Check if set or get env directive for $\_ENV active
- \[`Envparser()`\] - A construct parser constructor
- \[`load()`\] - Load an environment .env file or folder with .env files
- \[`getComment()`\] - Get a comment from a variable of .env file
- \[`getValue()`\] - Get a value from system environment variables and parsing variables
- \[`getAllValues()`\] - Returns parsed environment variables internally as array
- \[`getSystemVars()`\] - Fetch all or one system variables
- \[`checkSystemVar()`\]- Returns boolean if system variables exists
- \[`setStrictBool()`\] - Parse value to boolen on non-standard values such as 'y/n' or '1/0'
- \[`required()`\] - Instance of variable validator and variable validators

### EnvEditor

[](#enveditor)

- \[`Enveditor`\] - Instance environment for creating environment file
- \[`Help`\] - Common helps and issues in a code

###  Health Score

29

—

LowBetter than 59% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor1

Top contributor holds 98.1% 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 ~1 days

Total

9

Last Release

2990d ago

### Community

Maintainers

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

---

Top Contributors

[![marinsagovac](https://avatars.githubusercontent.com/u/8504733?v=4)](https://github.com/marinsagovac "marinsagovac (53 commits)")[![gitter-badger](https://avatars.githubusercontent.com/u/8518239?v=4)](https://github.com/gitter-badger "gitter-badger (1 commits)")

---

Tags

dotenveditorenvparserphpphpframeworkconfigparserloaderenvironmentenvdotenvdotenv-editordot envdev-toolsarray-env

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[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)[utopia-php/config

A simple Config library to managing application config variables

15240.1k3](/packages/utopia-php-config)[davidepastore/slim-config

A slim middleware to read configuration from different files based on hassankhan/config

338.9k1](/packages/davidepastore-slim-config)

PHPackages © 2026

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