PHP code example of nonameffh / yii2-setting

1. Go to this page and download the library: Download nonameffh/yii2-setting library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

nonameffh / yii2-setting example snippets


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

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

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

$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',
]);

php composer.phar