How to add modules to the system in YII2 through the admin panel?

Please share the experience
interested in the technology on which the system in Yii2 through the admin panel it would be possible to connect different modules of this system if necessary.
That is probably need some kind of script that would be prescribed in necessary files the necessary information in the module or the system itself would somehow miraculously saw the popup module and start working with him?
Thank you!
July 9th 19 at 11:23
3 answers
July 9th 19 at 11:25
First, to develop and prepare all available modules. In the file main.php/main-local.php (or in another place of the alleged connection of the modules) and enter this:
$modules = require('/path/to/modules/file.php');
// continue
return [
 'modules' => array_merge($modules, [
 'user' => [
 'class' => common\modules\user\Module::className(),

To create a label in the database, where are stored all the modules. Using CRUD to create a functionality to change the status of the modules. Next to the GridView to create a button, by pressing on which all active modules will generate the file '/path/to/modules/file.php' along the following lines:
return [
 'questions' => [
 'class' => common\modules\poll\questions\Module::className(),
 'answers' => [
 'class' => common\modules\poll\answers\Module::className(),
 'news' => [
 'class' => common\modules\news\Module::className(),
 'tags' => [
 'class' => common\modules\tags\Module::className(),
 'categories' => [
 'class' => common\modules\categories\Module::className(),
 'images' => [
 'class' => common\modules\images\Module::className(),
 'uploader' => [
 'class' => common\modules\uploader\Module::className(),
 'content' => [
 'class' => common\modules\content\Module::className(),
 'employees' => [
 'class' => common\modules\employees\Module::className(),
 'comments' => [
 'class' => common\modules\comments\Module::className(),

In principle, as it all. Only error here is not insure, because one module often works with others in pairs. For example, a free-standing modules, articles, blogs, news, weather - so Makar, can be mounted, but any Comments that are connected to other modules, probably without editing the code will not work.
thank you - Robert.Mo commented on July 9th 19 at 11:28
July 9th 19 at 11:27
use gii
July 9th 19 at 11:29
the question is to be functional in order to not a competent user himself could take the module and attach it to the system through the admin panel, as well as in cms
Need to implement it handles. But already easier to use CMS, where such functionality is already built into the system - Robert.Mo commented on July 9th 19 at 11:32

Find more questions by tags Yii