2017 © Pedro Peláez
 

yii2-extension yii2-setting

Store settings in the database. Forked from https://github.com/dinhtrung/yii2-setting

image

nonameffh/yii2-setting

Store settings in the database. Forked from https://github.com/dinhtrung/yii2-setting

  • Wednesday, July 4, 2018
  • by nonameffh
  • Repository
  • 1 Watchers
  • 0 Stars
  • 8 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 7 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

Yii2 Setting Component

Store settings in the database, (*1)

Installation

The preferred way to install this extension is through composer., (*2)

Either run, (*3)

php composer.phar require --prefer-dist dinhtrung/yii2-setting "*"

or add, (*4)

"dinhtrung/yii2-setting": "*"

to the require section of your composer.json file., (*5)

Usage

In your configuration file, add the setting component., (*6)

'components' => [
    ...
    'setting' => 'dinhtrung\setting\Setting',
    ...
]

You can choose which table to store the setting item, which will be auto-generate on demand., (*7)

'components' => [
    ...
    'setting' => [
        'class' => 'dinhtrung\setting\Setting',
        'setting_table' => 'website_setting',
    ]
    ...
]

In anywhere from your code, you can use those features:, (*8)

$setting = Yii::$app->setting->get('category', 'key', 'default value');
$setting = Yii::$app->setting->set('category', 'key', 'new value');

Or you can query all setting as one, (*9)

$settingArray = Yii::$app->setting->get('category', 'key');
$settingArray = Yii::$app->setting->get('category', 'key', 'default value');
$settingArray = Yii::$app->setting->set('category', [
    'key1' => 'value1',
    'key2' => 'value2',
    'key3' => 'value3',
]);

The Versions

04/07 2018

dev-master

9999999-dev

Store settings in the database. Forked from https://github.com/dinhtrung/yii2-setting

  Sources   Download

BSD-3-Clause

extension yii2 setting

04/07 2018

0.1.4

0.1.4.0

Store settings in the database. Forked from https://github.com/dinhtrung/yii2-setting

  Sources   Download

BSD-3-Clause

extension yii2 setting

13/06 2018

0.1.1

0.1.1.0

Store settings in the database. Forked from https://github.com/dinhtrung/yii2-setting

  Sources   Download

BSD-3-Clause

extension yii2 setting