Yii2 - Create module using Advanced template

636 Views Asked by At

I understand building a module is like a mini Yii2 application. I am trying to build a Blog module to reuse on different projects.

I would like to create a module containing backend and frontend and then being able to access each side.

In Yii2 basic there is no backend and frontend, so I create the "modules" folder on the app root. In the case of Yii2 advanced since we have backend and frontend.

All tutorials only show creating a module for backend or frontend.

I am creating a folder "modules" inside common. Inside module I am creating a folder "blog" with the following structure:

blog
L backend
L frontend
L common

what is the correct way to create and configure a module?

UPDATE I have found this article from @samdark, where He gives an example of the configuration, I am showing the configuration according to my structure:

'modules' => [
  'blogFrontend' => [
    'class' => 'common\blog\frontend\Blog',
    'anonymousComments' => false,
  ],
  'blogBackend' => [
    'class' => 'common\blog\backend\Blog',
  ],
]
0

There are 0 best solutions below