Yii2 MConfig Module
To install with Composer, simply require the latest version of this package., (*1)
composer require kovalin/yii2-mconfig "dev-master"
Download an archive of MConfig and extract module files it into the /modules/mconfig/ directory your Yii application., (*2)
From the command line, switch to the /modules directory your Yii application and run the following commands:, (*3)
git clone https://github.com/kovalin/yii2-mconfig.git mv yii2-mconfig mconfig
Database Migrations, (*4)
Before using Comments Widget, we'll also need to prepare the database., (*5)
php yii migrate --migrationPath=modules/mconfig/migrations
Config your Yii app, (*6)
Once the extension is installed, simply modify your application configuration as follows:, (*7)
return [ 'components' => [ 'MConfig' => [ 'class' => 'app\modules\mconfig\components\MConfig' ], 'modules' => [ 'mconfig' => [ 'class' => 'app\modules\mconfig\Module', ] ], ];
You can use this code in any place of your app., (*8)
Yii::$app->MConfig->get('adminEmail');