Yii2 Directory Structure

Hi,

with Yii 1.1 there was a "protected" folder what was very convinient way of separating actuall application files from framework what could be shared between multiple applications. That was great.

Now, with Yii 2 I can’t see a simple way but perhaps it’s lack of experience.

So, perhaps you can guide me how to get the following structure with Yii 2:

/var

|

www

|

|----Yii2

| . . |

| . . |–Yii2 (shared framework files)

| . . |

| . . |–Application 1 (like ‘protected’ files of Yii 1.1)

| . . |

| . . |–Application 2 (like ‘protected’ files of Yii 1.1)

| . . |

| . . |–Application 3 (like ‘protected’ files of Yii 1.1)

|

|

|–Application 1 (www files associated with http://application1.com)

|

|–Application 2 (www files associated with http://application2.com)

|

|–Application 3 (www files associated with http://application3.com)

Any idea?

I would like to have applications structured this way as there are various frameworks existent on the web server and some application use this framework while other that one. Having applications under the umbrella of "framework name" is a convinient way of separating them from each other for depencency clarity).

You can probably install Yii globally via “composer global require yiisoft/yii2” but I’m not sure it’s a good idea.

May be install advanced template and duplicate the backend and rename to another app name and so you will have Frontend, Backend and the Other End. Commons is already there so you have like four folders

Not sure how its going to affect updating via composer but since vendors folder is untouched, I think it have no impact!

Ah, you mean that. Yes, it’s absolutely possible.