Skip to content

Commit 89c4ca9

Browse files
committed
Added Config::append() and Config::prepend() documentation to the README
1 parent 6d583a6 commit 89c4ca9

File tree

1 file changed

+46
-1
lines changed

1 file changed

+46
-1
lines changed

README.md

Lines changed: 46 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,52 @@ $config->has('port'); // Returns false
337337

338338
---
339339

340+
### append
341+
> Append a value onto an existing array configuration option.
342+
343+
```php
344+
Config::append( string $key, mixed $value ) : bool
345+
```
346+
347+
| Parameter | Description |
348+
| --------- | -------------------------------- |
349+
| `$key` | Unique configuration option key |
350+
| `$value` | Config item value |
351+
352+
#### Example
353+
354+
Append `baz` to the `tags` config item array.
355+
356+
```php
357+
$config->set('tags', ['foo', 'bar'])
358+
$config->append('tags', 'baz'); // ['foo', 'bar', 'baz']
359+
```
360+
361+
---
362+
363+
### prepend
364+
> Prepend a value onto an existing array configuration option.
365+
366+
```php
367+
Config::append( string $key, mixed $value ) : bool
368+
```
369+
370+
| Parameter | Description |
371+
| --------- | -------------------------------- |
372+
| `$key` | Unique configuration option key |
373+
| `$value` | Config item value |
374+
375+
#### Example
376+
377+
Prepend `baz` to the `tags` config item array.
378+
379+
```php
380+
$config->set('tags', ['foo', 'bar'])
381+
$config->append('tags', 'baz'); // ['baz', 'foo', 'bar']
382+
```
383+
384+
---
385+
340386
### load
341387
> Load configuration options from a file or directory.
342388

@@ -387,7 +433,6 @@ Config::merge( Config $config [, bool $override = true ] ) : self
387433

388434
#### Examples
389435

390-
391436
Merge $anotherConfig into $config and override values in `$config` with values
392437
from `$anotherConfig`.
393438

0 commit comments

Comments
 (0)