Answer the question
In order to leave comments, you need to log in
How to correctly connect your namespace in yii2?
Hello.
There is a need to make a core that inherit from YII2 and that inherit application classes.
How to do it right? So that you can specify use #путь до класса ядра#
And everything worked)
Also, the question is, where is the best place to put the core? To the root?
I use advanced.
The folder will be called core.
Thanks to all.
Answer the question
In order to leave comments, you need to log in
How to correctly connect your namespace in yii2?
MyClass.php
along the path core/subnamespace/MyClass.php
. composer.json
how to execute herecomposer dumpautoload
. common/config/bootstrap.php
to directory aliasYii::setAlias('core', dirname(dirname(__DIR__)) . '/core');
Create folder core in application root
controllers
core
vendor
web
set namespace app\core
use like this use app\core
Also, the question is, where is the best place to put the core? To the root?
I use advanced.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question