Yii 2.0: yii2-settings

Yii2 settings with database module with GUI manager supported
4 followers

yii2-settings

Latest Stable Version License Total Downloads Monthly Downloads Daily Downloads

Yii2 settings with database module with GUI manager supported

Yii2-settings

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:

php 'components' => [ 'settings'=>[ 'class'=>'johnitvn\settings\Settings' ], ],

Ok let see this codesnipet to use:

````php $settings = Yii::$app->settings;

$value = $settings->get('section,'key');

$settings->set('section','key', 'value', 'integer');

````

Look at line:

php $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:

php 'modules' => [ 'settings' => [ 'class'=>'johnitvn\settings\Module', ] ]

And go to localhost/index.php?r=settings/manager/index.php

Be the first person to leave a comment

Please to leave your comment.

Create extension
Downloads
No downloadable files yet