Download the PHP package bupy7/yii2-config without Composer
On this page you can find all versions of the php package bupy7/yii2-config. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package yii2-config
yii2-config
This is module allow storing configuration parameters of application to database and management they dynamically from admin panel.
Installation
The preferred way to install this extension is through composer.
Either run
or add
to the require section of your composer.json
file.
Usage
Added to main application config:
Run migration:
Install demo parameters:
Config manager allowed by URL:
Adding config parameters
All config parameters necessarily must contain following options:
module
(string) - Name of module parameter where it will be use (app, shop, cart, blog, news and etc.).name
(string) - Name of parameter (mainPageTitle, adminEmail and etc.).
Module name and name must be unique.
label
(string) - Label of parameter. It must be translation message. More info toYii::t()
.type
(integer) - Type of field (bupy7\config\Module::TYPE_INPUT
,bupy7\config\Module::TYPE_TEXT
and etc). Allowed type field you can see tobupy7\config\Module
.rules
(array) - Rules of field. All rules must be specified without field name. Example:
More info to bupy7\config\models\Config::afterFind()
.
Additional options:
language
(string) - Language for which this config parameter will be uses ('ru', 'en' and etc). If language isbupy7\config\Module::LANGUAGE_ALL
or not set, then this parameter will be uses for all languages. More infoyii\console\Application::$language|yii\web\Application::$language
.value
(string) - Value of config parameter. By default empty.-
options
(array) - Options depend of field type. More info tobupy7\config\widgets\ActiveForm::field()
. Example for type: hint
(string) - Hint of field. It must be translation message. More info toYii::t()
.
Example configuration parameters:
After added configuration parameters run rescan:
Result:
Get value of config parameter
If parameter not found, then will be throw exception.
Set value of config parameter
If parameter not found, then will be throw exception.
Console commands
By default command name equals module name (module name -
config
and command name -config
).
Initialization the configuration parameters of application with deleting old parameters:
Adding new and deleting not exists config parameters of application:
After successfully adding/deleting parameters cache will be cleared.
License
yii2-config is released under the BSD 3-Clause License.