The settings component

The component of blaze is intended for internal usage, but you may of course access and use it the way you want to. It provides a very simple way to access the configuration settings.

The main settings are stored in the main config file. Please read the config file documentation to learn more about the used syntax and structure.

Getting a config setting


This method will give you the current setting you setup in the backend or in the config file.

$key must be a string representing an accessor for a value setup in the config file. For the 'debug' setting, which is held in the 'main' section of the config file, it would look like this:


This will return true if debug mode is currently enabled, false otherwise.

Setting configuration options

    $blaze->settings->set($key, $value);

Setting a configuration option is as easy as providing a valid $key and a valid $value. Make sure to read the config file documentation before using this method.

The method will return a boolean value which tells you if the operation was successful or not.

Be aware that misusing this function can break blaze!

Other useful functions

There are other methods that might help you.


This method will give you an associative array with all configuration options that the current config file holds.


You can remove settings from the config file. This method obviously can break blaze, so be sure to know what you are doing!!!


This method will give you the currently activated preset, if you are currently using one. The method will return 'development', 'production', 'maintenance' or a preset name you have setup. It returns false if the current setup does not match any configuration preset.


This method will return the time of the last configuration change as unix timestamp.

Plugin development

When you are developing a plugin for blaze, you might want to create a config file for your plugin. As plugins do not have access to blaze's components directly, it is recommended to create your own configuration which should be stored in the plugins folder.

Here is an example of a plugin class which has it's own settings handler:


    namespace blaze\plugins\myplugin;

    use \blaze\src\SettingsHandler;

    class myplugin extends \blaze\src\prototype\Plugin
        public function __construct()
            // Setting the path of the config file
            $this->settings = new SettingsHandler(__DIR__ . '/config.json');


The config file must be a valid json file holding at least an empty object. A valid config file could look like this:

        "category" : {
            "key" = "value"

If you do not provide a file to the settings handler object, it will use blaze's main configuration file.