/yii2-mconfig

Config module for yii2.

Primary LanguagePHP

Yii2 MConfig Module

Easy Installation

Install with composer

To install with Composer, simply require the latest version of this package.

composer require kovalin/yii2-mconfig "dev-master"

Download and install

Download an archive of MConfig and extract module files it into the /modules/mconfig/ directory your Yii application.

Install with git

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

Configuration

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

Usage

You can use this code in any place of your app.

Yii::$app->MConfig->get('adminEmail');