2017 © Pedro Peláez
 

library configuration

Helper for processing of configurations.

image

czproject/configuration

Helper for processing of configurations.

  • Sunday, June 24, 2018
  • by janpecha
  • Repository
  • 1 Watchers
  • 0 Stars
  • 8 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

CzProject\Configuration

Build Status, (*1)

Helper for processing of configurations., (*2)

Become a Patron! Buy me a coffee, (*3)

Installation

Download a latest package or use Composer:, (*4)

composer require czproject/configuration

CzProject\Configuration requires PHP 5.4.0 or later., (*5)

Usage

``` php use CzProject\Configuration\Configurator;, (*6)

$configurator = new Configurator; $configurator->addConfig(array( 'database' => array( 'host' => 'localhost', ), ));, (*7)

$configurator->addConfig(array( 'database' => array( 'user' => 'user123', 'password' => 'password123', ), ));, (*8)

$config = $configurator->getConfig();, (*9)

/* Returns: [ database => [ host => 'localhost', user => 'user123', password => 'password123', ] ] */, (*10)



### Config files ``` php use CzProject\Configuration\Configurator; use CzProject\Configuration\ConfigLoader; use CzProject\Configuration\Adapters; $loader = new ConfigLoader; $loader->addAdapter('json', new Adapters\JsonAdapter); $loader->addAdapter('php', new Adapters\PhpAdapter); $loader->addAdapter('neon', new Adapters\NeonAdapter); $configurator = new Configurator($loader); $configurator->addConfig('config.json'); $configurator->addConfig('config.local.php'); $config = $configurator->getConfig();

Parameters & placeholders

``` php use CzProject\Configuration\Configurator;, (*11)

$configurator = new Configurator; $configurator->addConfig(array( 'parameters' => array( 'database' => array( 'host' => 'localhost', 'driver' => 'mysql', ), ),, (*12)

'messages' => array(
    'user' => '%database.user%',
),

));, (*13)

$configurator->addConfig(array( 'parameters' => array( 'database' => array( 'user' => '%database.host%_user123', 'password' => 'password123', ), ), ));, (*14)

$config = $configurator->getConfigExpandedBy('parameters');, (*15)

/* Returns: [ parameters => [ database => [ host => 'localhost', driver => 'mysql', user => 'localhost_user123', password => 'password123', ] ],, (*16)

messages => [
    user => 'localhost_user123',
]

] */ ```, (*17)


License: New BSD License
Author: Jan Pecha, https://www.janpecha.cz/, (*18)

The Versions

24/06 2018

dev-master

9999999-dev

Helper for processing of configurations.

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

16/01 2017

v1.0.1

1.0.1.0

Helper for processing of configurations.

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

19/08 2016

v1.0.0

1.0.0.0

Helper for processing of configurations.

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires