schnittstabil / config_merge
Merge config arrays
Installs: 15 623
Dependents: 1
Suggesters: 0
Security: 0
Stars: 1
Watchers: 2
Forks: 0
Open Issues: 0
Requires
- php: >=5.6.0
Requires (Dev)
- codeclimate/php-test-reporter: ^0.3.0
- fabpot/php-cs-fixer: ^1.10
- phpunit/phpunit: ^5.3
- satooshi/php-coveralls: ^1.0
- squizlabs/php_codesniffer: ^2.6
This package is auto-updated.
Last update: 2024-10-26 03:21:16 UTC
README
Merge config arrays
Install
$ composer require schnittstabil/config_merge
Usage
use function Schnittstabil\ConfigMerge\config_merge; $target = json_decode(<<<'EOD' { "files": ["src", "tests"], "opts": { "unicorns": 0, "leprechauns": 666 } } EOD ); $source = json_decode(<<<'EOD' { "files": ["target"], "opts": { "unicorns": 42 } } EOD ); json_encode(config_merge($target, $source), JSON_PRETTY_PRINT); /* => { "files": [ "target" ], "opts": { "unicorns": 42, "leprechauns": 666 } } */
API
/** * Merge two configs. * * @param mixed $target Target config * @param mixed $source Source config * @param bool $appendArrays if true use `array_merge` * * @return mixed The merged config */ function config_merge($target, $source, $appendArrays = false)
License
MIT © Michael Mayer