-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExample.php
More file actions
29 lines (19 loc) · 740 Bytes
/
Example.php
File metadata and controls
29 lines (19 loc) · 740 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<?php
use Yohns\Core\Config;
use Yohns\Core\ConfigEditor;
include('vendor/autoload.php');
$dir = __DIR__.'/lib/Config';
// Initialize Config with a specific directory
$config = new Config($dir);
// Get a configuration value
echo Config::get('users', 'db_tables').PHP_EOL;
// Set a custom configuration value
Config::set('api_key', '12345');
// Retrieve a custom configuration value
echo Config::getCustom('api_key').PHP_EOL;
// Reload configurations from a different directory
//Yohns\Core\Config::reload('/new/path/to/config');
ConfigEditor::addToConfig(['add-new' => 'value'], 'default', true);
Config::reload($dir);
// get from the 'default' configs do not need to mention the file in get()
echo Config::get('add-new').PHP_EOL;