Yii2 vs Yii1 structure

Hi everyone!

After of using Yii 1.x for years, I decided to learn the basic of Yii2. :)

I have some questions

Why the folder structure in advanced template is complicated compared with Yii 1.x ?

  1. There are frontend and backend folders, I know the reason but it could be as Yii 1.x that the fronent run directly by index.php, no .htaccess to set the frontend as the main of domain url, and backend it could be as module (like Yii 1.x)

  2. why does not exist htaccess to deny access all the folders except frontend/web and backend/web by default install?

This is security weak by default installation of Yii2

  1. vendors and entire yii core framework resides inside of each project. In the Yii1 is much more easy to create


home/public_html/all folder and file of the project

In this way there are to advantages. 1) More secured because entire core framework is outside of public_html folder 2) We could have more of one web application with one same yii core framework (reduce storage resources and we have integrated web system in this way). Yii2 why is not like that by default ? And how could achieve the same results in easy way ?



If you like it a bit simpler, why not use the basic template?

You can move everything other than the "web" folder outside of "public_html". Just adjust the paths in the index.php.

  1. I suppose the advanced template has richer pre-structure folder structure according to professional and large scale system, Also it has the backend administrator structure ready for us

  2. Should I have to modify any path alias on the system, web configuration etc ? Is there any official wiki about all of them ? (for secure and url simplicity)

The project templates (both basic and advanced) assume that you can set the web root directories by editing httpd.conf or something similar. Once the web root directories has been set as “web”(basic) or “frontend/web” and “backend/web”(advanced), there’s no need anymore to worry about other directories.

In a sense, Yii2 is not so friendly to shared hosting environment. And we already have a lot of reason to avoid it other than that. ;)

Could you explain more about the reasons of not friendly shared hosting environment ? Is there any official Yii Wiki to these settings ? Many colleagues not use Yii2 due of those reasons and composer installation!

(although there is a link to download the Yii framework!)

I really don’t understand why some people want to avoid using composer.

We are now in the name-spaced world of PHP, in which the best way to manage 3rd party codes (including the framework itself) in your project is using composer.

As you should already know, shared hosting services usually pose a lot of burdens to the developer, among other thing is the unfriendliness to composer. For me, it can be a sole reason to avoid such a shared hosting service.

Many people use windows and hate to use console. Think what will happen if gii not exist in framework both Yii 1.x and 2.x (I know that many things of gii could be also done by console) even me I didn’t use Yii! I know some people that not use Yii 2 due to console interaction.

I think Yii 2 will be more attractive if a UI tool exist about composer, set permissions folder and set url about frontent/web/index.php as mydomain.com and backend/web/index.php as mydomain.com/backend by generating code.

This UI tools could be in browser like gii. All thinks will be display in one screen and developers will not search about tons of instructions.

May Yii core developers should be considered about that! :)

It does, it’s called IDE ;)

IDE about what ? I use Netbeans IDE for entire project but what about all of those things (composer, auto deny access except frontend,backend / web, auto settings for main and backend url)?

Solely talking about composer here. If you need a UI for composer, NetBeans offers that to you:


Composer is virtually an indispensable requisite to Yii 2 development. No matter what complaint you might have about it, you have to learn how to use it if you want to use Yii 2 (or any other modern PHP framework like Laravel, symfony, fuel, … etc).

“Many people”? Really? But you don’t have to be among them. Why don’t you come out and have fun with us? :)

“Many people”? Really? But you don’t have to be among them. Why don’t you come out and have fun with us? :)

[quote name=‘Unique konapaz’] Haha, Softark, I know all Yii programmers are unique, this is a reason that I still use Yii (1 or 2) ;)


here is a third template worth checking by @klimov-paul: https://github.com/yii2tech/project-template