Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/tacoberu/php-config
Config libs provides interface for loading config. Local, User-base, System-base, App-base.
https://github.com/tacoberu/php-config
Last synced: 15 days ago
JSON representation
Config libs provides interface for loading config. Local, User-base, System-base, App-base.
- Host: GitHub
- URL: https://github.com/tacoberu/php-config
- Owner: tacoberu
- License: mit
- Created: 2017-10-13T14:48:19.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2018-04-14T01:43:25.000Z (over 6 years ago)
- Last Synced: 2024-11-07T05:23:51.228Z (2 months ago)
- Language: PHP
- Size: 24.4 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
PHP Config
==========Config libs provides interface for loading config. Local, User-base, System-base, App-base.
## Use case
$config = Config::createByEnvironment('doe', null, getcwd()); // doe is application name
$config->has('name'); // true
$config->required('name'); // John
$config->required('core.name'); // Andrey
$config->required('lang[5].name'); // germany
$config->required('lang[de].name'); // germany
$config->required('core'); // [ name => Andrey, age => 42 ]
$config->required('nope'); // exception
$config->get('nope'); // NULL
$config->get('nope', 'Mark'); // Mark### Default configuration
$config = Config::createByEnvironment('doe', __dir__ . '/default.json', getcwd());### Own Parser
$config = Config::createByEnvironment('doe', __dir__ . '/default.xml', getcwd());
$config->addParser(new XmlParser);## Source of configuration
Configuration is loading from:
### system:
- Linux: /etc/doe.ini
- MacOS: /private/etc/doe.ini
- Win: ?### user:
- Linux: /home/current-user/.config/doe/config.ini
- MacOS: /Users/current-user/.config/doe/config.ini
- Win: ?### local:
./doe.ini
## Buildin format
- ini
- json## TODO
* own loader
* include
* merge parent