Skip to content

Commit

Permalink
add document for some method
Browse files Browse the repository at this point in the history
  • Loading branch information
MajidMohammadian committed Oct 24, 2023
1 parent 567a25e commit 8857f90
Showing 1 changed file with 95 additions and 6 deletions.
101 changes: 95 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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')
```

0 comments on commit 8857f90

Please sign in to comment.