1. Go to this page and download the library: Download jamesgober/config 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/ */
jamesgober / config example snippets
use JG\Config\Config;
$config = new Config('/path/to/config/files');
// Load files
$config->load('database.json');
$config->load('app.xml');
// Access values
$dbHost = $config->get('database.host', 'default_host');
// Check keys
if ($config->has('app.debug')) {
echo "Debug mode is enabled!";
}
// Add or update values
$config->add('app.name', 'MyApp');
// Delete specific values
$config->delete('app.version'); // Removes app.version
// Delete groups
$config->delete('app'); // Removes app.name, app.debug, etc.
use JG\Config\ConfigParserFactory;
// Register a parser for .custom files
ConfigParserFactory::registerParser('custom', MyCustomParser::class);