The Config API has received a completely overhauled API. Using the Config API, you can now retrieve at run-time any configuration property.
Configuration files are stored in resources/config
folders.
Use the get()
method to retrieve all properties of a defined configuration file.
Let's grab all properties of the theme's theme.config.php
file:
use Themosis\Facades\Config;
$all = Config::get('theme');
The above code is fetching all properties from the theme.config.php
file stored in the resources/config
folder. Simply provide the file name without the .config.php
extension as a parameter of the get()
method.
use Themosis\Facades\Config;
// Grab all theme templates
$templates = Config::get('templates');
When creating configuration files for a custom plugin, we recommend you to prefix your configuration file names with your domain tld, domain and plugin name in front of the configuration base name in order to avoid conflicts.
If your plugin creates a templates.config.php
file, it will break the theme's templates.config.php
configuration.
Here is a valid templates
configuration file for a custom plugin: com_domain_shop_templates.config.php
And in order to retrieve it from your plugin:
$templates = Config::get('com_domain_shop_templates');
Depending of your application, you might need to retrieve only one specific property from a configuration file.
For this, simply use a dot syntax to specify your property. For example, let's retrieve the namespace
property from the theme.config.php
file:
$namespace = Config::get('theme.namespace');
Note: you can't set/modify configuration values at run-time. Configuration values are read only.
Here is a complete list of the configuration files stored inside the theme.
key
or key/value
pairs.Details on how to modify and use those configurations are explained inside each file.
Made in Belgium