Skip to content

Latest commit

 

History

History
51 lines (34 loc) · 1.65 KB

README.md

File metadata and controls

51 lines (34 loc) · 1.65 KB

Config

Build Status Software License SensioLabsInsight

Config library can be used to store configuration options, which can be used later in the application. The set, get, has and remove methods as well as \ArrayAccess can be used to control the configuration options. For easy usage dot notation is supported to access nested arrays.

The source code is very easy to understand and can be extended to support more functionality when needed.

Installation

Via Composer

$ composer require joebengalen/config

Usage

<?php

require_once 'vendor' . DIRECTORY_SEPARATOR . 'autoload.php';

// Instantiate the config object.
$config = new \JoeBengalen\Config\Config();

// Load a php config file info the config object.
$config->load(__DIR__ . DIRECTORY_SEPARATOR . 'config.php');

// Set some more configurations.
$config->set([
    'database.host' => '127.0.0.1',
    'database.user' => 'root',
]);

// Show an array of all database configurations
var_dump($config->get('database'));

Testing

PHPUnit is used for testing. The source code is 100% covered.

There is an phpunit.xml.dist file with some default settings for phpunit.

$ phpunit

Note: phpunit is not included. The command assumes phpunit is installed globally.