Yii SystemParam extension
, (*1)
With this extension you easy config your Yii::$app->params from admin panel.
You need install extension with composer and run command:, (*2)
php yii params sync
This is command for synchronize your php config with db., (*3)
The preferred way to install this extension is through composer., (*4)
Either run, (*5)
php composer.phar require --prefer-dist yiicod/systemparam "*"
or add, (*6)
"yiicod/systemparam": "*"
to your composer.json, (*7)
Config:
'components' => array(
...
'systemparams => [
'commandMap' => [
'params' => [
'class' => SystemParamCommand::class,
'paramsAlias' => '@app/../common/config/params-system.php',
],
],
'modelMap' => [
'systemParam' => [
'class' => SystemParamModel::class,
],
'systemParamSearch' => [
'class' => SystemParamSearch::class,
],
],
'cacheDuration' => 28800,
'components' => [],
]
...
)
'bootstrap' => array('systemparams')
Usage
Use (or extend) yiicod\systemparams\controllers, or add to your controller crud actions:, (*8)
public function actions()
{
return [
'admin' => [
'class' => yiicod\systemparam\actions\admin\Admin::class,
],
'update' => [
'class' => yiicod\systemparam\actions\admin\Update::class,
],
];
}
Migration usage
Migration command or use manual(http://www.yiiframework.com/doc-2.0/guide-db-migrations.html) for configuration:, (*9)
yii migrate --migrationPath=@vendor/yiicod/yii2-systemparam/migrations