Skip to content

MesaVolt/env

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Environment helper for Symfony 4+

Latest Stable Version Build Status Coverage Status License

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 :

<?php

use Mesavolt\Env;

$secret = Env::get('APP_SECRET');
$empty = Env::getSafe('EMPTY_VAR');

Testing

composer dump-autoload # make sure vendor/autoload.php exists
./vendor/bin/phpunit