PHPackages                             devcirclede/env-reader - 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. [Parsing &amp; Serialization](/categories/parsing)
4. /
5. devcirclede/env-reader

ActiveProject[Parsing &amp; Serialization](/categories/parsing)

devcirclede/env-reader
======================

Simple Env Reader/Parser for PHP

0.4.3(3y ago)378[1 issues](https://github.com/vansari/EnvReader/issues)[2 PRs](https://github.com/vansari/EnvReader/pulls)1MITPHPPHP &gt;=8.1CI passing

Since Feb 20Pushed 3mo ago3 watchersCompare

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

READMEChangelog (8)Dependencies (4)Versions (11)Used By (1)

[![](https://camo.githubusercontent.com/d8fd778d4ac870a895824f8ef7bac15f82004f78dfed09b0cf1db035ac325d5c/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f72656c656173652f646576636972636c652d64652f456e765265616465722e737667)](https://camo.githubusercontent.com/d8fd778d4ac870a895824f8ef7bac15f82004f78dfed09b0cf1db035ac325d5c/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f72656c656173652f646576636972636c652d64652f456e765265616465722e737667) [![workflow](https://github.com/devcircle-de/EnvReader/actions/workflows/php.yml/badge.svg)](https://github.com/devcircle-de/EnvReader/actions/workflows/php.yml/badge.svg) [![](https://camo.githubusercontent.com/9fdd1e3d6d023901942a324e912060530187f0ab602aef82f0c16948edffc47e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f546573742532307061636b6167652532306f6e2d706c61792e70687073616e64626f782e696f2d626c75652e737667)](https://play.phpsandbox.io/devcirclede/env-reader)

EnvReader
=========

[](#envreader)

### PHP Environment Reader

[](#php-environment-reader)

Simple Environment Reader which can parse the Value to a specific type. It tries to find the Value in $\_ENV, $\_SERVER and via getenv. The logic is leaned on the [EnvVarProcessor](https://github.com/symfony/symfony/blob/6.2/src/Symfony/Component/DependencyInjection/EnvVarProcessor.php) from Symfony.

### Installation

[](#installation)

```
composer require devcirclede/env-reader
```

### Supported Types

[](#supported-types)

Actual included Types are:

- integer
- float
- string
- boolean
- array
- json

You can add your own Type by creating a class which implements the TypeInterface.

Example:

```
