Use Module aliases in module controller, model, components

How to use modules aliases in controller and model,components within same module?

apis are in versioning. so when i create new version v2 then i don’t want to change namespaces namespace in controller, models, components.

So i am trying to set aliases in module class and want to use in it in controller, models, components.


namespace api\modules\v1;

//\Yii::setAlias('models', 'api\modules\v1\models');

class v1 extends \yii\base\Module


    public $controllerNamespace = 'api\modules\v1\controllers';


    public $aliases = [

	  "@mymodels"	  => "@api/modules/v1",


    public function init()




        // custom initialization code goes here



MyController use alias "mymodels"


namespace api\modules\v1\controllers;

use mymodels\Airports; //<=================

use yii\helpers\Json;

//ini_set('memory_limit', '-1');

class UserController extends \yii\web\Controller


And it’s give me error