Module based config files

great framework i had used ever. i just love it. thank you guys for this work.

i would ask you to add feature that allows to have module based configs, just like magento does it.

having configs under modules allows to keep system unbound from modules. which allows to keep developers separate and do not play with system config each time. additionaly this allows to rewrite existing system config automatically when module is enabled.

currently to remove module i have to remove appropriate configuration lines at specific config.

here is my suggestion:

under module folder there should be to files:

‘config/global.php’ - will be used to overwrite exiting global config

‘config/module.php’ - will be used as module based configuration

yii will go through modules folder and will check those configs, and will merge them based on module settings

example config/global.php:




<?php

return [

    'id' => 'user',

    'enabled' => true,

    'class' => 'common\modules\user\Module',

    'depend' => ['core']

];



example config/module.php:




<?php

return [

    'components' => [

        'user' => [

            'class' => 'common\modules\user\models\User',

        ],

    ],

];



‘depend’ option allows to sort them properly. same idea used at magento software.

application should merge params from module.php into Yii::app()->modules

and params from global.php to global config.

sure this job should be wrapped by cache layer etc.

what you think guys about such functionality