2017 © Pedro Peláez
 

library easyconfig

Library for easy work with config files

image

ebogun/easyconfig

Library for easy work with config files

  • Monday, December 8, 2014
  • by EugeneBogun
  • Repository
  • 0 Watchers
  • 0 Stars
  • 53 Installations
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

Easy Config

Library for easy work with config files, (*1)

Installation

The preferred way to install this extension is through composer., (*2)

Either run, (*3)

php composer.phar require --prefer-dist ebogun/easyconfig "*"

or add, (*4)

"ebogun/easyconfig": "*"

to the require section of your composer.json file., (*5)

Usage

Once the extension is installed, simply use it in your code by :, (*6)

$configData = [
    'foo' => [
        ['id' => 1, 'name' => 'foo1.1'],
        ['id' => 2, 'name' => 'foo1.2'],
        ['id' => 3, 'name' => 'foo1.3'],
        ['id' => 4, 'name' => 'foo1.4'],
    ],
    'foo2' => 'value',
    '1',
];
$config = new EasyConfig($configData);
$config->config; // return $configData array;
$config->config = $configData; // set $configData as config;
//Get subConfig by config data
$config->used('@foo');// return new EasyConfig with config data
//[
//    ['id' => 1, 'name' => 'foo1.1'],
//    ['id' => 2, 'name' => 'foo1.2'],
//    ['id' => 3, 'name' => 'foo1.3'],
//    ['id' => 4, 'name' => 'foo1.4'],
//]
$config->used('@foo@1');// return new EasyConfig with config data ['id' => 1, 'name' => 'foo1.1']
$config->used('@foo@3@name');// return new EasyConfig with config data foo1.4
$config->used('@foo2');// return new EasyConfig with config data value
$config->used('@2');// return new EasyConfig with config data 1
//Find value in config

$configData = [
    'foo' => [
        ['id' => 1, 'name' => 'foo1.1'],
        ['id' => 2, 'name' => 'foo1.2'],
        ['id' => 3, 'name' => 'foo1.3'],
        ['id' => 4, 'name' => 'foo1.4'],
    ],
    'foo' => [
        ['id' => 1, 'name' => 'foo2.1'],
        ['id' => 2, 'name' => 'foo2.2'],
        ['id' => 3, 'name' => 'foo2.3'],
        ['id' => 4, 'name' => 'foo2.4'],
    ],
];
$config->find('id', 2);//Return array with find values ['id' => 1, 'name' => 'foo1.1'] and ['id' => 1, 'name' => 'foo2.1']
$config->find('id', 3, '>');//Return ['id' => 4, 'name' => 'foo1.4'] and ['id' => 4, 'name' => 'foo2.4']
$config->find('name', 'foo1.1');//Return ['id' => 1, 'name' => 'foo1.1']
TODO:Add examples code yet for bind function

The Versions

08/12 2014

dev-master

9999999-dev

Library for easy work with config files

  Sources   Download

BSD-3-Clause

The Requires

  • php >=5.4.0

 

by Eugene Bogun

config library easyconfig

08/12 2014

1.0.1

1.0.1.0

Library for easy work with config files

  Sources   Download

BSD-3-Clause

The Requires

  • php >=5.4.0

 

by Eugene Bogun

config library easyconfig

05/12 2014

1.0.0

1.0.0.0

Library for easy work with config files

  Sources   Download

BSD-3-Clause

The Requires

  • php >=5.4.0

 

by Eugene Bogun

config library easyconfig