phant / env
Manage env easily
1.0
2022-10-06 14:07 UTC
Requires
- php: >=8.1
Requires (Dev)
- phpstan/phpstan: ^1.4
README
Presentation
The environment variable manager makes it easy to manipulate your environment variables in your projects.
Installation
composer require phant/env
Technologies used
PHP 8.1
Composer
for dependencies management (PHP)
Usage
Get
If the variable is not defined, an exception will be thrown.
use Phant\Env\Manager as Env; echo Env::get('MY_VAR');
Get with default value
use Phant\Env\Manager as Env; echo Env::get('MY_VAR', 'default value');
Set
If the variable is already defined, an exception will be thrown.
use Phant\Env\Manager as Env; echo Env::set('MY_VAR', 'my new value');
Set value on existing var
use Phant\Env\Manager as Env; echo Env::set('MY_VAR', 'my new value', true);