Configure Site
\Lia::configure(array $options)
is used to configure certain properties on addons. Addon properties can also be modified directly via \Lia\AddonName::from($lia)->property_name = 'value'
.
configure()
makes it easy to provide a .json
configuration file that is different in different environments - such as to disable caching in development, but enable it in production.
Docs
- Configurable Properties: Lists configurable properties (and other info) on the built-in addons.
-
configure()
configure()
Example config:
.env/lia-config.json
{
"lia:server": {
"cache": {
"enabled": false
}
}
}
Example Config Usage:
deliver.php
<?php
require_once(__DIR__.'/vendor/autoload.php');
$lia = new \Lia();
$conf_file = file_get_contents(__DIR__.'/.env/lia-config.json');
$lia->configure(json_decode($conf_file, true));
// Add the built-in Package, which provides all the web-server features.
$server_package = \Lia\Package\Server::main($lia); // same as: new \Lia\Package\Server($lia, $fqn='lia:server');
// initialize other packages, deliver, etc.