What can be improved in Yii2?

Yii2 is my preferred framework, but in the last month I tried Laravel and I think we can learn something from them and improve Yii2.

I think that Yii should improve in some aspects, this are some features to improve the community behing yii:

  • More modern design for Yii2 framework website

  • Video tutorial for instalation (basic and advanced templates)

  • Slack channel (almost every project nowadays have a slack channel, is a way better then IRC)

  • A basic CMS based on yii2-app-advanced with:


  • user management

  • file manager

  • pages/blog system

  • menus manager

  • RBAC

  • AdminLTE template (is an example but something catchy)


In the framework there are also things to improve, for example:

  • better routes (more like laravel)

  • a better integration with "new" tecnologies, for example, use sass or less as default

  • adopt a default templating engine there are some options I tried blade and I like it because we can use php code direclty

This is are some of my tips. Please tell me what you think and give some tips to improve, to create a better community and help Yii to grow.

Yii2 is a framework, it is designed to be the core of an application, not the application.

There are a lot of CMS based on Yii2, you can use most of them as a boilerplate.


You can use any template engine with Yii, and for some of them Yii is also ready. See Template Engines docs


[size="2"]Yii allows use of SASS and LESS. Only need to configure a transpiler to only publish css files. Converter Yii2 [/size]

[size="2"]All this information is on Yii2 official documentation[/size]

IMHO Yii is the most universal php framework available. Every single line of code has been designed to the smallest detail.

If you can do with Laravel, you can do it with Yii2

Laravel has more opinions that what Yii has.

And that’s the reason why I prefer Yii :)

For templating, I use my own extension yii2-tale-jade which uses Tale-Jade, that allows me to freely mix Jade/Pug and raw PHP, even Twig.

We are already working on a new website :)

Slack ? Nope. Slack is proprietary and walled garden - it might be “popular” and “all the rage”, but it’s still shit. ;p

To improve Yii, I would like the advanced application template to be dropped completely!

It makes no sense for 99% of all projects.

It’s not a good design, and should not be an official Yii 2 template!

I have tried many times to get people to use a templating engine, but for some strange reason, people here seem to prefer to just use old-fashioned PHP for their views. …

You have good ideas, though! :)

There are already a lot of extensions/templates made by people, including CMS application templates, so we’ve got you covered.

Yes I agree Yii is very open and is easy to use things like SASS and LESS. It’s easy to use a template engine.

But for people that are starting Laravel "almost force" you to use SASS, to use a template engine, things that I think are very important and I think Yii should use that as default.

For me one of the reasons why Laravel is alot more used then Yii is because Yii don’t have a strong community and is not very catchy. There are any good boilerplate with for example adminLTE on backend, a filemanager and user manager. This is not a problem with yii core, Yii have 2 official templates basic and advanced but I think should have a basic CMS, clean and beautiful.

Yii should adopt by default the last technologies and do some pressure for users adopt that technologies.

In Laravel after I follow the basic tutorial, I end up with a website where I use a template engine, Elixir that is a class to implement Gulp (SASS, LESS), the basic Laravel example have a clean but good looking email template. This are some basic things, but I think are very important, and we can learn the good things from Laravel and adopt that to help yii to grow.

Yii is a very good framework but need some basic things to be more user friendly, most of them not related with the yii core.

You are completely failing to get the whole point of Yii :)

Everything that you suggest is only going to limit what you can do with Yii.

When I look for programming frameworks, I look for frameworks that does not do lots of things out of the box.

Because, when frameworks does that, we are forced to modify/work around those defaults.

So, it’s a lot better to not have those in the first place!

I have already integrated Yii 2 with Sass and Jade, I don’t need Yii 2 to do that for me!


I don’t want to have a lot of stupid defaults that I only have to change anyway!

I like that Yii - unlike "other frameworks" - does not ship with Kool-Aid!

Compared to Laravel, and CakePHP - where CakePHP is actually better (and more Yii-like) - Yii has a very small team.

But, yes: a new website, and a new forum, both are on their way :)

I agree!

It works like this:

People from the community create a Yii application template and a tutorial, and then it becomes an officially recommended option.

(But only an option!)

I hope that the new Yii website will make it easier to discover/promote community created "things" - like templates/extensions/tutorials.

Yes I agree with you put a lot of things inside the framework is not good. I think the framework is very good, but for the community to grow there are other things important.

I think a template with backend and frontend is very important I use that template in almost all of my website, but I think is not implemented in the right way because we need to change the default apache/nginx path for the things work right.

I agree with the 2 templates one with a backend/frontend and other with only a frontend. Maybe the yii team should try to create other team not to develop the yii core but to create some basic modules, a basic boilerplate and also create tutorials, things that help people to develop with yii.

I don’t agree with you Slack is a great tool, most of the programmers already have Slack installed, I think that many people will use slack if a official channel exist, but this is only my opinion.

As for the advanced application template:

In all cases - except once in a blue moon - the basic application template will do everything that one could possibly want from a Yii application!

Need a back-end ?

Use a module! :)

Then, the URL will be https://my.great.site/admin/

Modules are also much, much easier to use and reuse than application templates.

As for the web root: most other alternatives - RAILS, GO, .NET (?) - use a web root instead of just the project root.

That’s a good practice!

It keeps your code outside of the web root, which is critically important for security!

I wish that people would use modules instead of choosing the advanced template.

But, hey: that’s just me

However - and that’s important! there are people who have made Yii application templates with which the project root and the web root is the same.

IIRC, they are linked to from the official Yii guide!

You are right, that the advanced template - don’t use that! requires two separate web roots.

That’s obvious, really, since it is two separate applications!

People tend to forget that.

Use the basic application template - and lead a happy and flexible Yii life

Exactly I usually use advanced template because I already created a template for VestaCP (my control panel) that created the 2 separated webroots.

Like you said we can use a basic template and use a module, but where is a tutorial explaining that, this is a example of the things that yii should improved in relation with laravel. We should easily find the basic user cases covered in tutorials.

Yii framework is made by great programmers but I think they need talk with people that are not have so much experience and saw that there are some simple things they can make that will help the community to grow.

Personally I must cases I don’t like video tutorials, but I think that laravel is so huge because of that, its very easy to create a project following a tutorial. They have example for the most common websites. They explain easily how to use Gulp, and some good programmation practices. People that are starting usually go for the more user friendly option.

I have tested Laravel and I think Yii2 is more easy to use, we have the Gii that is great, the gridviews (in laravel it’s a lot more complicated to create a simple crud), but for someone that is starting the yii website is not catchy, use a IRC channel seams like 90’s, we have Gitter channel and I don’t find any information about that.

I am hoping that the new Yii website will help that :)

The Yii team, however, is small and busy, so to get better tutorials, we are really depending on the community!

Laravel is different, because of Laracasts and the amount of paid for content that it has.

AFAIK, there are very strong ties between Tut+ and Laravel - and it is difficult to compete with that.

And, to be honest: I prefer the honest approach that the Yii project has taken.

If you are interested, feel free to contribute to the Yii documentation project and the new Yii website project.

Me, I hope to get some time to dedicate to the new site, although I have a lot of other things on my plate. :)

And, regarding Slack:

The Yii community is already scattered all over the place: IRC, Gitter rooms (Russian and International), Facebook, 2 forums: this one, and a Russian one, and Stack Overflow …

Even the Yii website is divided in two: the main, official site, and the Russian site.

We want to upgrade our forum - Discourse or NodeBB - so that it becomes more modern, and is able to take the role of most, if not all, of these community channels.

Adding yet another community option is not "The Way To Go" right now, IMO!


Even the Yii documentation is divided between API docs and Guide and the Yii Cookbook - that could be improved.

The current website does not really help Yii, but - as I mentioned: we are working on that! :)

Also, we used to have a quickstart tutorial and a couple "official" video tutorials for Yii 1.

Sadly, this is not the case for Yii 2 - yet!

Don’t forget that Alexander Makarov has a Patreon that we can donate to so that he can work on Yii full time:


That will definitely help :)

My 2 cents

  • Yii advanced template should not come out of the box with framework itself.

  • Yii routing is not bad at all but could be improved.

  • Drop pjax half of the times its pjax beginners struggle with.

  • Asset management should not be part of the framework choice should be left to the user or offload it to gulp/grunt/node.

I agree the Yii2 framework should not be overload with "modules", but I think the official templates should follow the last technologies and should implemented by default gulp/grunt, instead of use only plain css. People that are starting if they want change the generated css and not use gulp/grunt but with this options by default more and more people will start using it. I think the frameworks should educate people to use good practices and this is an example.

If you test laravel you will see that you don’t need to use gulp (elixir) but they advice you to use it, I think this is the right way, and one of the reasons way the framework grows because you saw a Laravel project and usually they use the last technologies.

People like things that are simple, at this point is very simple to create a website with backend and frontend on Yii but is not catchy, we use the basic bootstrap template, is good for some project but if we have an alternative, with for example adminLTE on the backend and a more clean frontend, this will help the people that are testing the framework to be more attracted to use it.

Most of the things I think that should change are not related with the core and more related with usage like a good boilerplate:

  • a basic template similar to the one that we have but with a better design and a clean email template

  • a advanced template that not need 2 webroots with better design, probably adminLTE on backend and clean email template

  • a basic CMS with user module with RBAC, file manager, page and menu manager

Many pro users will use their own templates, but this are pro that already have modules from other projects, for people that are starting if they have a basic but complete start point this will help many people to start using Yii and grow our community

I don’t think you really understand what sets Yii apart from the competition. :)

People already have a lot of problems with installing Composer - now you want Yii to require them to install Node.js as well?


I have created Yii application templates that has Sass and Gulp support out of the box.

People can use those, if they want to. :)

As for a CMS?

There are several.

I like this one: https://www.yee-soft.com/

Because it is basically an application template.

I don’t agree with the design though: it shouldn’t be based on an advanced template, so I am probably going to rewrite it myself. :P

But it is really nice.

And has everything people could possibly want, working out of the box.

As for more modern application templates shipping with Yii: yes, once the new website is up, they will be updated to match the modern design.

Keep in mind that we are meant to take those application templates (basic and advanced) as starting points.

Any serious Yii developer is supposed to create their own, personal application templates - or at least heavily modify the results of running the stock templates.