PHPackages                             ergebnis/environment-variables - 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. ergebnis/environment-variables

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

ergebnis/environment-variables
==============================

Provides an abstraction for environment variables.

1.8.0(8mo ago)393.6k2[5 PRs](https://github.com/ergebnis/environment-variables/pulls)MITPHPPHP ~8.1.0 || ~8.2.0 || ~8.3.0 || ~8.4.0 || ~8.5.0CI failing

Since Feb 23Pushed 3mo ago1 watchersCompare

[ Source](https://github.com/ergebnis/environment-variables)[ Packagist](https://packagist.org/packages/ergebnis/environment-variables)[ Docs](https://github.com/ergebnis/environment-variables)[ RSS](/packages/ergebnis-environment-variables/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (9)Dependencies (14)Versions (16)Used By (0)

environment-variables
=====================

[](#environment-variables)

[![Integrate](https://github.com/ergebnis/environment-variables/workflows/Integrate/badge.svg)](https://github.com/ergebnis/environment-variables/actions)[![Merge](https://github.com/ergebnis/environment-variables/workflows/Merge/badge.svg)](https://github.com/ergebnis/environment-variables/actions)[![Release](https://github.com/ergebnis/environment-variables/workflows/Release/badge.svg)](https://github.com/ergebnis/environment-variables/actions)[![Renew](https://github.com/ergebnis/environment-variables/workflows/Renew/badge.svg)](https://github.com/ergebnis/environment-variables/actions)

[![Code Coverage](https://camo.githubusercontent.com/abbb3c32c448af830085d0ebbc3231b7cd917b36f7a943d4c76e25c8948a50cb/68747470733a2f2f636f6465636f762e696f2f67682f65726765626e69732f656e7669726f6e6d656e742d7661726961626c65732f6272616e63682f6d61696e2f67726170682f62616467652e737667)](https://codecov.io/gh/ergebnis/environment-variables)

[![Latest Stable Version](https://camo.githubusercontent.com/edc82c90b55b98f059caf97ec2135aa888fd1f389ce269d352533f84a17cf540/68747470733a2f2f706f7365722e707567782e6f72672f65726765626e69732f656e7669726f6e6d656e742d7661726961626c65732f762f737461626c65)](https://packagist.org/packages/ergebnis/environment-variables)[![Total Downloads](https://camo.githubusercontent.com/7797bc300ba3e0a577fdb729fce59e5a2513df750f1272850ee0d555148af3f2/68747470733a2f2f706f7365722e707567782e6f72672f65726765626e69732f656e7669726f6e6d656e742d7661726961626c65732f646f776e6c6f616473)](https://packagist.org/packages/ergebnis/environment-variables)[![Monthly Downloads](https://camo.githubusercontent.com/c503be9e3f41642cd0a6ae35a6eaf9664ccca8dfaf754c7b4bb0c8ea7600f4cd/687474703a2f2f706f7365722e707567782e6f72672f65726765626e69732f656e7669726f6e6d656e742d7661726961626c65732f642f6d6f6e74686c79)](https://packagist.org/packages/ergebnis/environment-variables)

This project provides a [`composer`](https://getcomposer.org) package with an abstraction of environment variables.

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

[](#installation)

Run

```
composer require ergebnis/environment-variables
```

Usage
-----

[](#usage)

This package provides the interface [`Ergebnis\Environment\Variables`](src/Variables.php) along with the following production implementations:

- [`Ergebnis\Environment\SystemVariables`](#ergebnisenvironmentsystemvariables)

This package also provides the following test implementations:

- [`Ergebnis\Environment\FakeVariables`](#ergebnisenvironmentfakevariables)
- [`Ergebnis\Environment\ReadOnlyVariables`](#ergebnisenvironmentreadonlyvariables)
- [`Ergebnis\Environment\TestVariables`](#ergebnisenvironmenttestvariables)

### Production Implementation

[](#production-implementation)

#### `Ergebnis\Environment\SystemVariables`

[](#ergebnisenvironmentsystemvariables)

If you want to read, set, and unset environment variables in an object-oriented way in a production environment, you can use [`Ergebnis\Environment\SystemVariables`](src/SystemVariables.php):

```
