PHP code example of sam-burns / config-tree
1. Go to this page and download the library: Download sam-burns/config-tree library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
sam-burns / config-tree example snippets
$configBuilder = new \ConfigTree\Builder\ConfigTreeBuilder();
$configBuilder->addSettingsFromPath('/path/config.json');
$config = $configBuilder->buildConfigTreeAndReset();
$mysqlUsername = $config->getSettingFromPath('parameters/mysql/user');
// $mysqlUsername === "dbuser"
$dbConfig = $config->getSubtreeFromPath('parameters/mysql');