PHPackages                             mesavolt/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. [Utility &amp; Helpers](/categories/utility)
4. /
5. mesavolt/env

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

mesavolt/env
============

Static helper to get environment variables in a Symfony 4+ app, loaded either from .env or .env.local.php

v0.0.1(7y ago)01.6k[1 PRs](https://github.com/MesaVolt/env/pulls)MITPHPPHP &gt;=7.1CI passing

Since Feb 28Pushed 5y ago2 watchersCompare

[ Source](https://github.com/MesaVolt/env)[ Packagist](https://packagist.org/packages/mesavolt/env)[ RSS](/packages/mesavolt-env/feed)WikiDiscussions master Synced 3w ago

READMEChangelogDependencies (1)Versions (3)Used By (0)

Environment helper for Symfony 4+
=================================

[](#environment-helper-for-symfony-4)

[![Latest Stable Version](https://camo.githubusercontent.com/74120106eddd75df654bf3f2f72e96f2c251f65660546a07bfa5c1e379e0f5b0/68747470733a2f2f706f7365722e707567782e6f72672f6d657361766f6c742f656e762f762f737461626c65)](https://packagist.org/packages/mesavolt/env)[![Build Status](https://camo.githubusercontent.com/b610b81f285a3a2a60379fda30b63a028d5a82bb9a56900b4cd6994262e3fad1/68747470733a2f2f7472617669732d63692e636f6d2f4d657361566f6c742f656e762e737667)](https://travis-ci.com/MesaVolt/env)[![Coverage Status](https://camo.githubusercontent.com/03913f311d88e95eea9fe437f717cfe8229a288f40f386cbc4eb7e818fc01e19/68747470733a2f2f636f6465636f762e696f2f67682f4d657361566f6c742f656e762f6272616e63682f6d61737465722f67726170682f62616467652e737667)](https://codecov.io/gh/MesaVolt/env)[![License](https://camo.githubusercontent.com/24278c828c9ba2f8808a22041e275ad0679f74bc0367c5c18b6d47b4bb55c6bc/68747470733a2f2f706f7365722e707567782e6f72672f6d657361766f6c742f656e762f6c6963656e7365)](https://packagist.org/packages/mesavolt/env)

Usage
-----

[](#usage)

Add the package to your project :

```
composer require mesavolt/env
```

Use `Mesavolt\Env::has()` to test if an environment variable exists in your app and `Mesavolt\Env::get()` to retrieve it.

> Quick note: By default, `Env::get($name)` throws an exception when the variable is defined but is empty. Use `Env::getSafe($name)` to not throw an exception and get the empty value.

```
APP_SECRET="i can see dead people"
EMPTY_VAR=
```

Use it in your project :

```
