0

I am little confused before starting a new project in Yii2 advanced template. So, i am asking this question.

I have done some projects in "Yii2 basic" app in which we use modules for different parts of our application like for adminpanel, api we create different folders in 'modules folder'.

I had also done a project in Yii2 advanced template it was multiapp project so we used advanced template. As we already had 'backend' and 'frontend' separated in Yii2 advanced template so we didn't created any module in 'modules' folder.

Now, i want to ask what is right approach. like in my new project we have users and products in backend so is it appropriate to create different modules for them in 'modules' folder or will it be ok if i create there controllers and models directly in backend folder.

what are the advantages of using modules folder in advanced template?

Thanks for answers in advance.

Ninja Turtle
  • 1,293
  • 2
  • 24
  • 50
  • Please see this explanation : http://stackoverflow.com/questions/14139519/what-is-the-difference-between-component-extension-module-in-yii/14157650#14157650, applies to yii2 as well – arkoak Jan 15 '17 at 04:39

2 Answers2

1

The advantage of module's use is primarly the possibilities of a resue of this components in several diffferente project. you can easly separate you common repetative functionalities in several modules and use the same code in different prject indipendently of the "template" or scaffolding you use for the single applicazione or group of applications.

Do the fact the modules are self-contained software units that consist of models, views, controllers, and other supporting components
modules are, not only usable as a sort of mini-applications, but also as a easy way for code organization and reuse.

ScaisEdge
  • 131,976
  • 10
  • 91
  • 107
0

Modules are used to reduce our work.

Example:

In most of projects have user login function like login , signup , forget passsword ,password reset.

If you write code for these functions as module . You can use any project

So there is know need to write one code again and again.

Yasar Arafath
  • 605
  • 1
  • 9
  • 30