2017 © Pedro Peláez
 

library config-merge

A simple function that merges config arrays

image

kanellov/config-merge

A simple function that merges config arrays

  • Monday, March 16, 2015
  • by kanellov
  • Repository
  • 1 Watchers
  • 1 Stars
  • 577 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 12 % Grown

The README.md

config-merge

Build Status, (*1)

A simple function that merges configuration files., (*2)

Example

In the following example *.local.php files override the *.global.php files., (*3)

configuration file /some/path/a.global.php, (*4)

<?php return array(
    'db'    => array(
        'dsn'      => 'mysql:dbname=production_db;host=production_server',
        'options' => array(
            PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES \'UTF8\'',
        ),
    ),
    'dompdf' => array(
        'temp_dir'            => 'cache',
        'default_font'        => 'dejavu',
        'enable_remote'       => true,
        'font_height_ratio'   => 0.95,
        'enable_html5_parser' => true,
    ),
);

configuration file /some/path/b.local.php, (*5)

<?php return array(
  'db'    => array(
      'dsn'      => 'mysql:dbname=dev_db;host=dev_server',
      'user'     => 'username',
      'password' => 'password',
  ),
  'recaptcha' => array(
      'public_key'  => 'SOMEPUBLICKEY',
      'private_key' => 'SOMEPRIVATEKEY',
  ),
);

merge the configuration files using, (*6)

$config = \Knlv\config_merge('/some/path', array('global', 'local'));

the returned configuration, (*7)

array(
  'db'    => array(
      'dsn'      => 'mysql:dbname=dev_db;host=dev_server',
      'user'     => 'username',
      'password' => 'password',
      'options' => array(
          PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES \'UTF8\'',
      ),
  ),
  'recaptcha' => array(
      'public_key'  => 'SOMEPUBLICKEY',
      'private_key' => 'SOMEPRIVATEKEY',
  ),
  'dompdf' => array(
      'temp_dir'            => 'cache',
      'default_font'        => 'dejavu',
      'enable_remote'       => true,
      'font_height_ratio'   => 0.95,
      'enable_html5_parser' => true,
  ),
);

The Versions

16/03 2015

dev-master

9999999-dev https://github.com/kanellov/config-merge

A simple function that merges config arrays

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

merge configuration config array

16/03 2015

0.1.1

0.1.1.0 https://github.com/kanellov/config-merge

A simple function that merges config arrays

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

merge configuration config array

16/03 2015

dev-develop

dev-develop https://github.com/kanellov/config-merge

A simple function that merges config arrays

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

merge configuration config array

03/03 2015

0.1.0

0.1.0.0 https://github.com/kanellov/config-merge

A simple function that merges config arrays

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

merge configuration config array