To install with Composer, simply require the latest version of this package.
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.
- You can download zip archive https://codeload.github.com/kovalin/yii2-mconfig/zip/master
From the command line, switch to the /modules directory your Yii application and run the following commands:
git clone https://github.com/kovalin/yii2-mconfig.git
mv yii2-mconfig mconfig
Database Migrations
Before using Comments Widget, we'll also need to prepare the database.
php yii migrate --migrationPath=modules/mconfig/migrations
Config your Yii app
Once the extension is installed, simply modify your application configuration as follows:
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.
Yii::$app->MConfig->get('adminEmail');