A lightweight configuration management library for PHP applications.
MIT License
SimpleConfig is a lightweight PHP configuration management library designed to provide an easy and flexible way to handle configuration settings. It leverages dflydev/dot-access-data
for convenient access to nested configuration values using dot notation.
Use Composer to install SimpleConfig into your project:
composer require devuri/config
use Urisoft\SimpleConfig;
// Define your configuration path and allowed files
$configPath = __DIR__ . '/config';
$allowedFiles = ['app', 'database'];
// Instantiate the SimpleConfig object
$config = new SimpleConfig($configPath, $allowedFiles, 'production', 'path/to/configCache.php');
// Access configuration values
$appName = $config->get('app.name');
$dbHost = $config->get('database.connections.mysql.host');
// Set a new configuration value
$config->set('app.timezone', 'UTC');
// Retrieve the newly set value
echo $config->get('app.timezone'); // Outputs: UTC
// Manually clear the configuration cache
$config->clearCache();
Please submit pull requests or create issues for any features, fixes, or improvements.
Licensed under the MIT License. See the LICENSE file for details.