Answer the question
In order to leave comments, you need to log in
How to create a new application (object) in Yii2 basic template?
I read the documentation on Yii2 and did not fully understand how to properly create a new application. Also, there are no detailed instructions on the Internet.
I'm trying to place a new application in a new directory, I threw folders with controllers, models and views there.
If I understand correctly, the main changes will affect the configuration ( id, basePath, aliases, controllerNamespace
) for web and console (to use migrations, etc.), and namespace
for all internal files of this application.
In theory, everything should work, but I get this kind of error:
The file or directory to be published does not exist: E:\XAMPP\htdocs\local.dev\new_app\vendor\bower/jquery/dist
Answer the question
In order to leave comments, you need to log in
Good afternoon.
Create a virtual host, each with its own document root and server name
<VirtualHost *:80>
ServerAdmin [email protected]
DocumentRoot "C:\xampp\htdocs\test\web"
ServerName test
ServerAlias www.test
ErrorLog "logs/test-error.log"
CustomLog "logs/test-access.log" common
</VirtualHost>
<VirtualHost *:80>
ServerAdmin [email protected]
DocumentRoot "C:\xampp\htdocs\test1\web"
ServerName test1
ServerAlias www.test1
ErrorLog "logs/test1-error.log"
CustomLog "logs/test1-access.log" common
</VirtualHost>
Delete /vendor & composer.lock
composer global require "fxp/composer-asset-plugin:^1.3.1"
composer install
Thanks to all. In fact, the error arose due to the fact that I did not define an alias for the vendor folder:
As a result, I scattered the applications into separate directories. Everything is working. On the input script, I wrote a small code to determine the name of the subdomain, depending on which a separate application will be built. Also created several console applications. I don’t know how correct this is) But in general it’s convenient and works)
If you need more than 1 application - why then the basic template? What you have done is an advanced template. And it would be rational to take it. There, and take out aliases and a bunch of other things are more correctly implemented for 2 or more applications.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question