I used Yii 1 for my ultra simple website, now would like to upgrade my learning to Yii 2. With Yii 1, I could move the Yii framework folder out of the sample project and update the paths that point to it. But on Yii2, does not seem possible.
Default structure inside my www folder:
|- www/yii2-basic-app |- www/yii2-basic-app/web |- www/yii2-basic-app/vendor |- www/yii2-basic-app/vendor/jquery |- www/yii2-basic-app/vendor/cebe |- www/yii2-basic-app/vendor/yiisoft |- www/yii2-basic-app/vendor/... |- www/yii2-basic-app/...
Change to this structure:
Foo |- vendor |- vendor/jquery |- vendor/cebe |- vendor/yiisoft |- vendor/... |- www |- www/yii2-basic-app |- www/yii2-basic-app/web |- www/yii2-basic-app/vendor-folder-moved-from-here |- www/yii2-basic-app/...
I tried using set_include_path(); to include the vendor folder, this is the exception thrown.
Invalid Parameter – yii\base\InvalidParamException The file or directory to be published does not exist: D:\Localhost\www\mywebsite.v2\vendor/yiisoft/jquery in D:\Localhost\yii2\yiisoft\yii2\web\AssetManager.php line 260
There is a $path value at line 260, it checks if the folder exist, if I echo $path, this is the output:
Yii2 is looking for jquery here:
Is this due to the DIR magic constant? Basically vendor folder NEEDs to be one level up from the web folder?
The reasons I want to do this is for example if I have a CMS on my own web server (or even development machine) with multiple clients’ website hosted there, I wanted just the one Yii2 vendor folder, since everything is the same for all, everything will pull from that same pool.
If this is not permitted or not recommended, please let me know, I’ll change my plans. Thank you in advance.