This is a package for env modification the contents of different Laravel projects.
Run the following command to pull in the latest version:
composer require jobmetric/laravel-env-modifier
To use the services of this package, please follow the instructions below.
By default, the main Laravel env file is in the settings, if you want to change another file and get data from it, you should use this method.
JobMetric\EnvModifier\Facades\EnvModifier::setPath('complete path file')
You must pass it an array with keys and each key contains a value.
JobMetric\EnvModifier\Facades\EnvModifier::set([
'KEY1' => 123,
'KEY2' => 456,
...
])
You can use the following modes to receive the data of an env file.
1- Get a specific key
JobMetric\EnvModifier\Facades\EnvModifier::get('KEY1')
2- Get some specific keys
JobMetric\EnvModifier\Facades\EnvModifier::get('KEY1', 'KEY2', ...)
3- Get array specific keys
JobMetric\EnvModifier\Facades\EnvModifier::get(['KEY1', 'KEY2', ...])
4- Get an array with a given number of keys
The fourth method is less used, it is to show off the power of the program.
JobMetric\EnvModifier\Facades\EnvModifier::get(['KEY1', 'KEY2', ...], 'KEY3', 'KEY4', ...)
array(
'KEY1' => 123,
'KEY2' => 456,
...
)
You can use the following modes to delete the data of an env file.
1- Delete a specific key
JobMetric\EnvModifier\Facades\EnvModifier::delete('KEY1')
2- Delete some specific keys
JobMetric\EnvModifier\Facades\EnvModifier::delete('KEY1', 'KEY2', ...)
3- Delete array specific keys
JobMetric\EnvModifier\Facades\EnvModifier::delete(['KEY1', 'KEY2', ...])
4- Delete an array with a given number of keys
The fourth method is less used, it is to show off the power of the program.
JobMetric\EnvModifier\Facades\EnvModifier::delete(['KEY1', 'KEY2', ...], 'KEY3', 'KEY4', ...)
You can use the following method to check a key in a file.
JobMetric\EnvModifier\Facades\EnvModifier::has('KEY1')