https://github.com/usox/hacore
Read json configs in hack strict mode
https://github.com/usox/hacore
config hacklang hhvm json
Last synced: 6 months ago
JSON representation
Read json configs in hack strict mode
- Host: GitHub
- URL: https://github.com/usox/hacore
- Owner: usox
- License: mit
- Created: 2017-03-19T20:53:07.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2019-02-15T07:33:17.000Z (over 6 years ago)
- Last Synced: 2025-02-08T05:44:40.416Z (8 months ago)
- Topics: config, hacklang, hhvm, json
- Language: Shell
- Homepage:
- Size: 15.6 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://travis-ci.org/usox/hacore)
Hacore - Hack Config Reader
===========================Hacore provides a simple approach to read json formatted config files in hack
strict mode.Sample config
-------------Hacore treats all config values as strings and will explicitly cast them. To
access the values of a single key, just use `getLeaf($key_name)`. To get a
complete branch of options, use `getBranch($key_name)`.```json
{
"foo":"bar",
"barfoo":666,
"more":{
"config":"options"
}
}
``````php
$reader = new \Usox\Hacore\Reader();
$reader->load('path-to-config.json')$reader->getLeaf('foo'); // returns 'bar'
$reader->getLeaf('barfoo'); // returns '666'
$reader->getBranch('more'); // returns a new Reader instance
```