2017 © Pedro Peláez
 

library config_merge

Merge config arrays

image

schnittstabil/config_merge

Merge config arrays

  • Thursday, April 14, 2016
  • by schnittstabil
  • Repository
  • 1 Watchers
  • 1 Stars
  • 15,468 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

Schnittstabil\ConfigMerge Build Status Coverage Status Code Climate

SensioLabsInsight, (*1)

Merge config arrays, (*2)

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, (*3)

The Versions

14/04 2016

dev-master

9999999-dev

Merge config arrays

  Sources   Download

MIT

The Requires

  • php >=5.6.0

 

The Development Requires

merge array recursive sequential assoc

14/04 2016

2.0.0

2.0.0.0

Merge config arrays

  Sources   Download

MIT

The Requires

  • php >=5.6.0

 

The Development Requires

merge array recursive sequential assoc

11/04 2016