2017 © Pedro Peláez
 

library config

Load config files from various formats to PHP arrays and easily retrieve deeply nested items

image

affinity4/config

Load config files from various formats to PHP arrays and easily retrieve deeply nested items

  • Sunday, May 21, 2017
  • by Affinity4
  • Repository
  • 2 Watchers
  • 0 Stars
  • 9 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 8 Versions
  • 0 % Grown

The README.md

Config

Load config files from various formats to PHP arrays and easily retrieve deeply nested items, (*1)

Features

  • Specify any Loader which implements Affinity4\Config\LoaderInterface
  • Get entire array of values
  • Get specific value using simple, readable pattern

Installation

Affinity4/Config is available via composer:, (*2)

composer require affinity4/config

Usage

Given the contents of config.yml are:, (*3)

env: local
db:
    local:
        name: test
        user: root
        pass: root
        host: 127.0.0.1

Using the Affinity4 Yaml Loader:, (*4)

$loader = new Affinity4\Config\Loader\Yaml(__DIR__ . '/config.yml');

$config = new Affinity4\Config\Config($loader);

Get complete array using the get() method without passing a key:, (*5)

$config->get();

Would return:, (*6)

[
    'env' => 'local',
    'db' => [
        'local' => [
            'name' => 'test',
            'user' => 'root',
            'pass' => 'root',
            'host' => '127.0.0.1',
        ]
    ]
]

Or get a specific value by specifying a the map to the nested key:, (*7)

$config->get('db local name'); // test

Loaders

Affinity4/Config comes with these Loaders out of the box:, (*8)

  • Json
  • Yaml
  • Neon
  • PHP

Tests

Run tests:, (*9)

vendor/bin/phpunit

Licence

(c) 2017 Luke Watts (Affinity4.ie), (*10)

This software is licensed under the MIT license. For the full copyright and license information, please view the LICENSE file that was distributed with this source code., (*11)

The Versions

21/05 2017

dev-master

9999999-dev

Load config files from various formats to PHP arrays and easily retrieve deeply nested items

  Sources   Download

MIT

The Requires

 

The Development Requires

by Luke Watts

21/05 2017

1.1.4

1.1.4.0

Load config files from various formats to PHP arrays and easily retrieve deeply nested items

  Sources   Download

MIT

The Requires

 

The Development Requires

by Luke Watts

20/05 2017

1.1.3

1.1.3.0

Load config files from various formats to PHP arrays and easily retrieve deeply nested items

  Sources   Download

MIT

The Requires

 

The Development Requires

by Luke Watts

16/05 2017

dev-scrutinizer-patch-1

dev-scrutinizer-patch-1

Load config files from various formats to PHP arrays and easily retrieve deeply nested items

  Sources   Download

MIT

The Requires

 

The Development Requires

by Luke Watts

16/05 2017

1.1.2

1.1.2.0

Load config files from various formats to PHP arrays and easily retrieve deeply nested items

  Sources   Download

MIT

The Requires

 

The Development Requires

by Luke Watts

16/05 2017

1.1.1

1.1.1.0

Load config files from various formats to PHP arrays and easily retrieve deeply nested items

  Sources   Download

MIT

The Requires

 

The Development Requires

by Luke Watts

12/01 2017

1.1.0

1.1.0.0

Load config files from various formats to PHP arrays and easily retrieve deeply nested items

  Sources   Download

MIT

The Requires

 

The Development Requires

by Luke Watts

11/01 2017

1.0.0

1.0.0.0

Load config files from various formats to PHP arrays and easily retrieve deeply nested items

  Sources   Download

MIT

The Requires

 

The Development Requires

by Luke Watts