Environment variable container

1.0.1 2017-07-09 12:00 UTC

This package is auto-updated.

Last update: 2024-11-29 04:14:32 UTC


README

Build Status Code Coverage

Environment variable container.

Installation

composer require crysalead/env

API

Example

use Lead\Env\Env;

$env = new Env($_SERVER + $_ENV);

$env['PHP_SELF'];

$env['UNEXISTING_VARIABLE']; // returns `false` like `getenv()` on undefined

$env['CUSTOM_VARIABLE'] = 'myvalue';

// Multiple set
$env->set([
    'CUSTOM_VARIABLE2' => 'myvalue2',
    'CUSTOM_VARIABLE3' => 'myvalue3'
]);

isset($env['CUSTOM_VARIABLE']);

unset($env['CUSTOM_VARIABLE']);

$env->clear(); // removes all variables.