Recommend this page to a friend! |
Download |
Info | Documentation | Files | Install with Composer | Download | Reputation | Support forum | Blog | Links |
Last Updated | Ratings | Unique User Downloads | Download Rankings | |||||
2024-08-27 (1 month ago) | Not enough user ratings | Total: 58 This week: 3 | All time: 10,535 This week: 13 |
Version | License | PHP version | Categories | |||
php-config-managemen 1.0 | MIT/X Consortium ... | 8 | Files and Folders, Configuration, PHP 8 |
Description | Author | ||||||||||||||||||||||
This package can load configuration values from JSON files. |
|
PHP class for managing configuration throughout an application.
Use composer to install PHP Config.
composer require kris-ro/php-config
require YOUR_PATH . '/vendor/autoload.php';
use KrisRo\PhpConfig\Config;
# static call
# providing a path (optional) to a folder here will load all json files in the folder
Config::buildConfig('/absolute/path/to/your/folder/with/json/files');
// magic call for debug and salt entries in the config array
Config::debug();
Config::salt();
// setter call
// set method returns the new value
Config::set('database/username', 'k2'); # returns 'k2'
Config::get('database/username'); # returns 'k2'
// path here is also optional; if provided all json files in that folder will be loaded
new Config('/absolute/path/to/your/folder/with/json/files');
$this->assertEquals('k2', Config::set('database/username', 'k2'));
// verify new value
$this->assertEquals('k2', Config::get('database/username'));
(new Config())
->loadConfigFile(/absolut/path/to/first.json')
->loadConfigFile(/absolut/path/to/second.json')
->loadConfigFile(/absolut/path/to/nth.json');
(new Config())
->setConfigPath('/absolute/path/to/your/folder/with/json/files')
->loadConfigFile(first-file-to-load.json')
->loadConfigFile(second-file-to-load.json')
->loadConfigFile(nth-file-to-load.json');
Files (7) |
File | Role | Description | ||
---|---|---|---|---|
configs (3 files) | ||||
src (1 file) | ||||
tests (1 file) | ||||
composer.json | Data | Auxiliary data | ||
README.md | Doc. | Documentation |
Files (7) | / | configs |
File | Role | Description |
---|---|---|
config-1.json | Data | Auxiliary data |
config-2.json | Data | Auxiliary data |
config-3.json | Data | Auxiliary data |
The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page. |
Install with Composer |
php-config-managemen-2024-08-27.zip 4KB | |
php-config-managemen-2024-08-27.tar.gz 3KB | |
Install with Composer |
Version Control | Unique User Downloads | Download Rankings | |||||||||||||||
100% |
|
|
Applications that use this package |
If you know an application of this package, send a message to the author to add a link here.