diff --git a/README.md b/README.md index b15e489..e533a3f 100644 --- a/README.md +++ b/README.md @@ -9,17 +9,106 @@ Run the following command to pull in the latest version: composer require jobmetric/env-modifier ``` -### Add service provider +## Documentation + +To use the services of this package, please follow the instructions below. + + -Add the service provider to the providers array in the config/app.php config file as follows: +### Set file path + +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. ```php -'providers' => [ +JobMetric\EnvModifier\Facades\JEnvModifier::setPath('complete path file') +``` + +### Set data +You must pass it an array with keys and each key contains a value. + +```php +JobMetric\EnvModifier\Facades\JEnvModifier::set([ + 'KEY1' => 123, + 'KEY2' => 456, ... +]) +``` + +### Get data + +You can use the following modes to receive the data of an env file. + +1- Get a specific key + +```php +JobMetric\EnvModifier\Facades\JEnvModifier::get('KEY1') +``` - JobMetric\EnvModifier\EnvModifierServiceProvider::class, -] +2- Get some specific keys + +```php +JobMetric\EnvModifier\Facades\JEnvModifier::get('KEY1', 'KEY2', ...) ``` -## Documentation +3- Get array specific keys + +```php +JobMetric\EnvModifier\Facades\JEnvModifier::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. + +```php +JobMetric\EnvModifier\Facades\JEnvModifier::get(['KEY1', 'KEY2', ...], 'KEY3', 'KEY4', ...) +``` + +#### How to return get data + +```php +array( + 'KEY1' => 123, + 'KEY2' => 456, + ... +) +``` + +### Delete data + +You can use the following modes to delete the data of an env file. + +1- Delete a specific key + +```php +JobMetric\EnvModifier\Facades\JEnvModifier::delete('KEY1') +``` + +2- Delete some specific keys + +```php +JobMetric\EnvModifier\Facades\JEnvModifier::delete('KEY1', 'KEY2', ...) +``` + +3- Delete array specific keys + +```php +JobMetric\EnvModifier\Facades\JEnvModifier::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. + +```php +JobMetric\EnvModifier\Facades\JEnvModifier::delete(['KEY1', 'KEY2', ...], 'KEY3', 'KEY4', ...) +``` + +### Has key + +You can use the following method to check a key in a file. + +```php +JobMetric\EnvModifier\Facades\JEnvModifier::has('KEY1') +```