Skip to content
This repository was archived by the owner on Feb 21, 2025. It is now read-only.
/ hacore Public archive

Read json configs in hack strict mode

License

Notifications You must be signed in to change notification settings

usox/hacore

Repository files navigation

Build Status

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