2017 © Pedro Peláez
 

library configure

Generic Configuration Library

image

minphp/configure

Generic Configuration Library

  • Tuesday, October 31, 2017
  • by clphillips
  • Repository
  • 3 Watchers
  • 0 Stars
  • 285 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 9 Versions
  • 9 % Grown

The README.md

Minphp/Configure

Build Status Coverage Status, (*1)

A generic configuration library for getting and setting values for keys., (*2)

Installation

Install via composer:, (*3)

composer require minphp/configure:~2.0

Basic Usage

<?php
use Minphp\Configure\Configure;

$config = new Configure();
$config->set('key', 'value');
$config->get('key');

Supported Actions

  • $config->set($key, $value) - Add or update a value in the config
  • $config->get($key) - Get a value from the config
  • $config->exists($key) - Find if a key is set in the config
  • $config->remove($key) - Remove a key from the config

Using Config Files

Configure currently supports the following formats:, (*4)

  • PHP (a file that returns an array or object supported by \ArrayIterator)
  • JSON

config.php, (*5)

<?php
return array(
    'key1' => 'value',
    'key2' => array('key' => 'value')
);

config.json, (*6)

{
    "key1": "value",
    "key2": {"property": "value"}
}

usage.php, (*7)

<?php
use Minphp\Configure\Configure;

$config = new Configure();
$config->load(new Reader\PhpReader(new \SplFileObject('config.php')));
echo $config->get('key1'); // prints "value"
echo $config->get('key2')['key']; // prints "value";

$config->load(new Reader\JsonReader(new \SplFileObject('config.json')));

echo $config->get('key1'); // prints "value"
echo $config->get('key2')->property; // prints "value";

Note: Configure won't mess with your data. JSON objects are returned as actual objects, not hashes., (*8)

A literal translation of the above config.json file would be:, (*9)

return array(
    'key' => 'value',
    'key2' => (object)array('key' => 'value')
);

The Versions

31/10 2017

dev-master

9999999-dev http://github.com/phillipsdata/minphp-configure

Generic Configuration Library

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

by Cody Phillips

31/10 2017

2.1.x-dev

2.1.9999999.9999999-dev http://github.com/phillipsdata/minphp-configure

Generic Configuration Library

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

by Cody Phillips

31/10 2017

2.1.0

2.1.0.0 http://github.com/phillipsdata/minphp-configure

Generic Configuration Library

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

by Cody Phillips

31/10 2017

dev-phpreader-return-empty-array

dev-phpreader-return-empty-array http://github.com/phillipsdata/minphp-configure

Generic Configuration Library

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

by Cody Phillips

31/10 2017

dev-improve-config-file-loading

dev-improve-config-file-loading http://github.com/phillipsdata/minphp-configure

Generic Configuration Library

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

by Cody Phillips

11/12 2015

2.0.0

2.0.0.0 http://github.com/phillipsdata/minphp-configure

Generic Configuration Library

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

by Cody Phillips

11/12 2015

dev-update-namespace

dev-update-namespace http://github.com/phillipsdata/minphp-configure

Generic Configuration Library

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

by Cody Phillips

05/04 2015

dev-php7

dev-php7 http://github.com/phillipsdata/minphp-configure

Generic Configuration Library

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

by Cody Phillips

04/02 2015

1.0.0

1.0.0.0 http://github.com/phillipsdata/minphp-configure

Generic Configuration Library

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

by Cody Phillips