usox / hacore
Read json configs in strict mode
Installs: 844
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 3
Forks: 0
Open Issues: 0
Language:Shell
Requires
- hhvm: ^4.0
- hhvm/hsl: ^4.0
Requires (Dev)
- facebook/fbexpect: ^2
- hhvm/hacktest: ^1.4
- hhvm/hhast: ^4.0
This package is auto-updated.
Last update: 2024-10-15 19:33:59 UTC
README
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)
.
{ "foo":"bar", "barfoo":666, "more":{ "config":"options" } }
$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