Answer the question
In order to leave comments, you need to log in
Yii2. Where are the files located?
Where is it more correct to place:
- third-party auxiliary classes (for example, a class for working with images);
- behaviors
- widgets
- actions
Now I have them in
behaviors => common\behaviors
auxiliary classes => common\classes
widgets, actions, components => common\components
Answer the question
In order to leave comments, you need to log in
Third-party classes are connected through the composer.
If your class is common for the frontend and backend, then place it in common\behaviors (common\actions, common\widgets, etc.), if only for the frontend or only for the backend, then frontend\behaviors or backend\behaviors, respectively.
It is also not necessary to shove widgets, actions, components into one namespace, arrange them in different ones (widgets in common\widgets, actions in common\actions, etc.)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question