Alias needed with yii2-app-advanced?

I just have added a new application at my yii2-app-advanced based project. I don’t want to go into the details - it is the common structure so I have an own namespace called api, a single contoller and some config and view files.

I just would like to know if it is required to add an alias into common/config/bootstrap.php (another place might also be possible, of course)? Because without, the controller could not be found, though controllerNamespace was api/controllers what should be correct. Only if I add an alias (Yii::setAlias(’@api’, dirname(dirname(DIR)) . ‘/api’);) the controller gets found. The controller is in namespace api/controllers.

So is it required to ad an alias? I’m wondering about this…

It is required, and common/config/bootstrap.php is a good place for this, yes.

Thank you, Bizley. I wasted hours to find this out. Can it be that the guide/doc is missing this? Or where should one know this from?

The path aliases of Advanced Application Template are described in https://github.com/yiisoft/yii2-app-advanced/blob/master/docs/guide/structure-path-aliases.md

Maybe this should be mentioned in some more accessible place as well.

Now I found it. It is actually documented here: doc