sam-burns / config-tree
Installs: 30
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/sam-burns/config-tree
Requires
- php: ^7.1
- symfony/yaml: ^2.7|^3.0
Requires (Dev)
- behat/behat: ^3.3
- phpspec/phpspec: ^3.2
- phpunit/phpunit: ^5.7
This package is auto-updated.
Last update: 2025-10-24 06:37:09 UTC
README
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');