Yii2 which version choose, basic or advanced


(Patriota) #1

I wrote article Which Yii2 project template to choose, basic or advanced? Could I ask check my article ? grammar, ideas. Thanks for any feedback.


(Jacob Moen) #2

I strongly disagree :)

The basic does indeed have a console end, so you are wrong there.

The basic is a great starting point for all Yii 2 applications, except those very few that actually need two separate applications (frontend/backend).

I am using the basic application template for 99% of my Yii applications.

Including many with admin functionality.

That you need two separate applications to have a backend is wrong!

Because, and I think it’s better in almost all cases, you can use a module.

So, the difference between basic and advanced is only this:

Basic -> one application.

Advanced -> two applications with shared code.

What I’ve found is that advanced application template will give you a lot of complexity compared to the basic application template.

And it does not really offer any advantages.

I am building several big and advanced projects based on the basic application template.

Can’t really think of any reasons why anyone would use the advanced template.

Other than maybe that they don’t want to use a template which name is “basic”


(Jacob Moen) #3

Having said that: great to see Yii 2 articles! Kudos for writing it.


(Jacob Moen) #4

In my opinion, they really should be renamed to ‘one’ and ‘two’ - because the basic is not really basic and the advanced is not really advanced (over-engineered, yes).

Yes, I know that all of us really want to be using the ‘advanced’ application template, simply because it sounds better than ‘basic’, right?

Sorry for the rant.


(Patriota) #5

Many thanks for your help :) , I will think about it and improves.I probably agree with most of the changes .

But you look at it as someone with advanced knowledge. I would want to approach this issue from the side of someone for the first time faces a choice.

The aim of this article was to show that the choise of Yii 2 Basic Application Template(that I missed). is often a better choice.


(Patriota) #6

Ok, I corrected text. The first time I did not have idea I can expand admin panel using modules. Now I am richer for this experience. :rolleyes:

You can still consider that change is to small. But I’ll wait with further changes to the time to get a new level.


(Jacob Moen) #7

I agree with your re-written article - great work!


(Alexander Makarov) #8

Thanks for the article. Post it to http://yiifeed.com/ to get more readers.


(Apsprint) #9

As a newbie I find this helpful, even though I have already been through this choice, started with advanced and rewrote the app using the basic. I didn’t really need two applications, just a section only available to admin, managers and staff, customers only need the “frontend”.

It was not that hard to create a pseudo backend with an admin module, using RBAC to control access. Doing it this way solved a lot of problems by not creating the problems in the first place like, "How do I get it to redirect to the Home page of the frontend when I log out of the backend?", and other similar issues.

I wound up having to co-opt the User MVC from the Advanced into my Basic app, which they should do with the basic out of the box anyway, in my opinion. The docs tell you why you should replace what they give you (demo-demo, admin -admin), and what to replace it with, which turns out to be what they give you in the advanced version.


(Gene Rodrigues) #10

The advanced template or a variant of that template are best suited for projects where you need to use a single backend to manage a domain with one or more subdomains, or for intranets where an IT manager wants to manage the net from a single access point.

However, if you build MVC triads as self-dependent modules (i.e., as self-dependent as possible) it’s fairly easy to switch between the basic, advanced or custom templates if you always store your shared files in a common directory. That is, make the modules as reuseable as possible without breaking Dry and Kiss principles. Modules can have their own config files, message files, custom components, etc. Using a common directory with the basic template makes it possible to switch between templates easily because the base URLs and paths for common files are standardized. This avoids changes to the use statements in the various module files. For basic, this involves introducing the bootstrap.php from advanced. I can think of a few other approaches to achieve the same code reusability requirements (e.g., composer).

To make modules as independent as possible, it makes sense to incorporate the admin MVC triads into the module within the directory structure or as a nested submodule. Then access those triads through your menu routes or other navigation system.

In any case, I think of the basic and advanced templates as example templates. It’s fairly easy to modify the basic and advanced templates to create custom variants. Yii pretty much lets you build custom templates to suit your needs and wants.