PHP code example of elephox / configuration

1. Go to this page and download the library: Download elephox/configuration 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/ */

    

elephox / configuration example snippets




use Elephox\Configuration\ConfigurationManager;
use Elephox\Configuration\Json\JsonFileConfigurationSource;

$configurationManager = new ConfigurationManager();
$configurationManager->add(new JsonFileConfigurationSource('config.json'));
$configurationManager->add(new JsonFileConfigurationSource('config.local.json', optional: true));
$configurationRoot = $configurationManager->build();

echo $configurationRoot['database:host']; // 'localhost'
echo $configurationRoot['database:port']; // 3306
echo $configurationRoot['env']; // 'local'