Install
composer require zenlix/zenenvUse
use ZenEnv\ZenEnv;Initializing ZenEnv
$env = new ZenEnv('/home/rustem/web/public_html/.env');Get array of key/values
$env->get();Result:
print_r($env-get());['PARAM1'=>'VALUE1','PARAM2'=>'VALUE2']Delete by keys
$env->delete(['KEY1', 'KEY2']);Before:
PARAM1=VALUE1
PARAM2=VALUE2
PARAM3=VALUE3After:
PARAM3=VALUE3Add key/value
$env->add([
'KEY'=>'VAL',
'KEY2'=>'VAL2'
]);Before:
PARAM1=VALUE1
PARAM2=VALUE2
PARAM3=VALUE3After:
PARAM1=VALUE1
PARAM2=VALUE2
PARAM3=VALUE3
KEY=VAL
KEY2=VAL2Change key/value
$env->set([
'PARAM1'=>'VALUE',
'PARAM2'=>'VALUE'
]);Before:
PARAM1=VALUE1
PARAM2=VALUE2
PARAM3=VALUE3After:
PARAM1=VALUE
PARAM2=VALUE
PARAM3=VALUE3