Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bookiu/php-config
php-config is a config file reader, that can read yaml json and php format config file.
https://github.com/bookiu/php-config
Last synced: about 1 month ago
JSON representation
php-config is a config file reader, that can read yaml json and php format config file.
- Host: GitHub
- URL: https://github.com/bookiu/php-config
- Owner: bookiu
- License: mit
- Created: 2020-06-27T07:40:03.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2020-06-28T07:53:40.000Z (over 4 years ago)
- Last Synced: 2024-04-17T15:43:50.033Z (9 months ago)
- Language: PHP
- Size: 22.5 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# php-config
`php-config` is a config file reader, that can read yaml json and php format config file.
## Installation
`php-config` is available via composer. Just add the following code to your `composer.json` file under **required** section and execute command `composer update` or you can run directly:
```bash
composer require yaxin/php-config
```## Usage
## Examples
```text
config directory structure.
├── app.yaml
├── abc.php
├── bcd.yml
├── cde.json
├── info.php
├── regions
│ └── beijing.yml
├── production
| └── database.yml
├── testing
| └── database.yml
└── development
└── database.yml
``````php
use Yaxin\PHPConfig\PHPConfig;$config = new PHPConfig('/path/to/config/path', '/path/to/compile_cache/path', 'production');
$config->get('app.name');
// output is: php-config$config->get('regions.beijing.name');
// output is: beijing$config->get('database.default.host');
// output is: 1.2.3.4$config->get('none.exist.key');
// output is: null$config->get('none.exist.key', 'php-config');
// output is: php-config
```## License
[MIT](https://choosealicense.com/licenses/mit/)