Setting alias with Alias

I’m moving to my production server, in my params.php file I’m trying to set an Alias using another alias like:


$phantom = \Yii::getAlias('@vendor') . '/phantomjs.exe';

Yii::setAlias('@phantom', $phantom);

But getting: Fatal error: Uncaught exception ‘yii\base\InvalidParamException’ with message ‘Invalid path alias: @vendor’ on line 152

( ! ) yii\base\InvalidParamException: Invalid path alias: @vendor

Can I not set an Alias using an Alias here?

The $vendor alias works when I use it in views

Because in views it already exist. In params nothing is initialized yet.