yii2-settings
Yii2 settings component, (*1)
Installation
The preferred way to install this extension is through composer., (*2)
Either run, (*3)
php composer.phar require --prefer-dist pendalf89/yii2-settings "*"
or add, (*4)
"pendalf89/yii2-settings": "*"
to the require section of your composer.json
file., (*5)
Apply migration, (*6)
yii migrate --migrationPath=vendor/pendalf89/yii2-settings/migrations
Configuration:, (*7)
'components' => [
'settings' => [
'class' => 'pendalf89\settings\Settings',
],
],
Usage
$settings = Yii::$app->settings;
$settings->set('sitemap.update_cache_freq', 21600);
echo $settings->get('sitemap.update_cache_freq'); // 21600
// Sample with default value:
echo $settings->get('sitemap.update_cache_freq', 21600); // 21600