sam-burns/config-tree

1.0.0 2017-01-19 13:25 UTC

This package is auto-updated.

Last update: 2024-11-24 04:42:26 UTC


README

Build Status Scrutinizer Code Quality

Config Tree

Description

A library for reading config files of various formats, and representing them as config tree objects.

Example of usage

config.json file:

{
    "parameters": {
        "mysql": {
            "user": "dbuser"
        }
    }
}
$configBuilder = new \ConfigTree\Builder\ConfigTreeBuilder();
$configBuilder->addSettingsFromPath('/path/config.json');
$config = $configBuilder->buildConfigTreeAndReset();

$mysqlUsername = $config->getSettingFromPath('parameters/mysql/user');
// $mysqlUsername === "dbuser"

Or, do stuff like this:

$dbConfig = $config->getSubtreeFromPath('parameters/mysql');