thiphariel / config-file-loader
Configuration file loader in PHP
1.2.0
2018-05-18 15:43 UTC
Requires
- php: >=7.1.0
Requires (Dev)
- phpunit/phpunit: ^6.3
- satooshi/php-coveralls: ^1.0
- squizlabs/php_codesniffer: ^3.0
This package is not auto-updated.
Last update: 2025-04-13 07:16:00 UTC
README
This library is a configuration file loader in PHP that supports JSON and PHP files at the moment.
Requierements
- PHP >=7.1
Installation
composer require thiphariel/config-file-loader
Usage
// Create an instance of Config $config = new Config(); // Load JSON configuration file $config->load("config.json"); // Load PHP configuration file $config->load("config.php"); // Getting values $host = $config->get("host"); $port = $config->get("port"); // Nested keys $env = $config->get("environment.dev");
Examples of configurations can be found in the tests/config
folder.