-
Notifications
You must be signed in to change notification settings - Fork 7
ConfigRegistry
Daniel M. Hendricks edited this page Aug 26, 2017
·
2 revisions
ConfigRegistry loads plugin/theme settings from an array or JSON file.
You can load settings from a JSON file (example):
use WordPress_ToolKit\ConfigRegistry;
$cache = new ConfigRegistry( '/path/to/config.json' );
...or you can load from an array:
use WordPress_ToolKit\ConfigRegistry;
$config = new ConfigRegistry(
'name' => 'My Plugin',
'slug' => 'my-plugin',
'data' => array(
'version' => '1.0.0',
'textdomain' => 'my-text-domain'
)
);
Getting a configuration option:
$version = $config->get('data/version');
Merging two ConfigRegistry objects:
$config = $config->merge( new ConfigRegistry( '/path/to/other.json' ) );