PHP code example of geeklab / conf
1. Go to this page and download the library: Download geeklab/conf 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/ */
geeklab / conf example snippets
// Where the configurations are.
$configurationDirectory = __DIR__ . '/config/';
// Load Configuration system with the JSON Configuration Driver
$configuration = new GLConf(
new JSONConfDriver(
$configurationDirectory . 'system.json', // Path and file name of main (top level) configuration.
$configurationDirectory // Path to the other configuration files.
),
['mySecretKey' => md5(rand())], // Value injections.
['keys_to_lower'] // Options:
// Options to change the case of the key if returning a keyed array:
// keys_upper_case, keys_lower_case, keys_same_case
);
$configuration->init();
// Get the whole configuration.
var_export($configuration->getAll());
// Get one item.
var_export($configuration->get('space_pants.look_at_my'));