navatech / yii2-setting
This package is abandoned and no longer maintained.
The author suggests using the phuongdev89/yii2-setting package instead.
Yii2 Setting for other application
Package info
github.com/navatech/yii2-setting
Type:yii2-extension
pkg:composer/navatech/yii2-setting
1.0.5
2019-04-18 04:19 UTC
Requires
- php: >=5.6.0
- bower-asset/awesome-bootstrap-checkbox: 0.3.*
- insolita/yii2-iconpicker: 2.*
- kartik-v/yii2-editable: 1.*
- kartik-v/yii2-grid: 3.*
- kartik-v/yii2-password: 1.*
- kartik-v/yii2-tabs-x: 1.*
- kartik-v/yii2-widgets: 3.*
- navatech/yii2-navatech-base: ^1.0
- navatech/yii2-roxymce: 2.*
Requires (Dev)
None
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
Yii2 Setting for other application
Installation
The preferred way to install this extension is through composer.
Either run
php composer.phar require navatech/yii2-setting "1.0.*"
or add
"navatech/yii2-setting": "1.0.*"
to the require section of your composer.json file.
Usage
Once the extension is installed, simply use it in your code by :
Migration
Migration run
yii migrate --migrationPath=@navatech/setting/migrations
Config /common/config/main.php to use Yii::$app->setting
'components' => [ 'setting' => [ 'class' => 'navatech\setting\Setting', ], ],
Config backend modules in backend/config/main.php to manage settings
'modules' => [ 'setting' => [ 'class' => 'navatech\setting\Module', 'controllerNamespace' => 'navatech\setting\controllers', 'enableMultiLanguage' => false,//set true if navatech/yii2-multi-language installed and want to translate setting ], 'gridview' => [ 'class' => '\kartik\grid\Module', ], 'roxymce' => [ 'class' => '\navatech\roxymce\Module', ], ],
Config at backend
backend : http://you-domain/backend/web/setting ####Attention:
- Store Range required if type in (select, multiselect, checkbox, radio), supported string with comma, json, callback function.
Example:
- String: 1,2,3 or A,bcd,ef
- Json: {"0" : "abc", "1" : "def"}
- Callback: app\helpers\ArrayHelper::getItems()
Just create simple static function namedgetItemsinapp\helpers\ArrayHelper
namespace app\helpers;
class ArrayHeper {
public static function getItems(){
return [
0 => "abc",
1 => "def",
"ghi" => 2,
];
}
}
Use Your Setting
Once you set the value at the backend. Simply access your setting by the following code (auto-suggest code worked):
echo Yii::$app->setting->get('siteName'); echo Yii::$app->setting->siteName;