johnitvn/yii2-settings
最新稳定版本:1.0.5
Composer 安装命令:
composer require johnitvn/yii2-settings
包简介
Yii2 settings with database module with GUI manager supported
README 文档
README
Yii2 settings with database module with GUI manager supported
Installation
The preferred way to install this extension is through composer.
Either run
php composer.phar require --prefer-dist johnitvn/yii2-settings "*"
or add
"johnitvn/yii2-settings": "*"
to the require section of your composer.json file.
Usage
####Add settings into component config:
'components' => [ 'settings'=>[ 'class'=>'johnitvn\settings\Settings' ], ],
####Ok let see this codesnipet to use:
$settings = Yii::$app->settings; $value = $settings->get('section,'key'); $settings->set('section','key', 'value', 'integer'); $settings->delete('section,'key'); $settings->deleteAll('section,'key'); $settings->clearCache(); // automatic call when use set()
####Look at line:
$settings->set($section,$key,$value,$type);
You can use $section for distribute setting such as system,user... And the $type will be use for get settings. This extension have used settype for set the type of a setting when you get it
####If you want to manager setting with GUI then add settings into module config:
'modules' => [ 'settings' => [ 'class'=>'johnitvn\settings\Module', ] ]
And go to localhost/index.php?r=settings/manager/index.php
统计信息
- 总下载量: 5.75k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 21
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Apache-2.0
- 更新时间: 2015-06-27