1. Go to this page and download the library: Download solophp/configs 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/ */
solophp / configs example snippets
use Solo\Configs;
// Create a new instance with your configurations
$configs = new Configs([
'database' => [
'host' => 'localhost',
'username' => 'root',
'password' => 'secret',
],
'app' => [
'name' => 'My Application',
'debug' => true,
'settings' => [
'timezone' => 'UTC'
]
]
]);
// Get values using dot notation
$dbHost = $configs->get('database.host'); // 'localhost'
$appName = $configs->get('app.name'); // 'My Application'
$timezone = $configs->get('app.settings.timezone'); // 'UTC'
// Using default values
$cache = $configs->get('cache.enabled', false); // false (using default)
// Get entire sections
$dbConfig = $configs->get('database'); // Returns entire database array
$allConfigs = $configs->get(); // Returns all configurations
// Using magic method
$appName = $configs->app_name; // 'My Application'