Yii2 main application
To install inside the configuration file, write this inside the $ config array
'aliases' => [ '@name1' => 'path/to/path1', '@name2' => 'path/to/path2', ],
Link: http://www.yiiframework.com/doc-2.0/guide-structure-applications.html
But as mentioned here ,
The @yii attribute is determined when the Yii.php file is included in your script entry. The remaining aliases are defined in the application constructor when the application configuration is applied.
If you need to use a predefined alias, write one component and bind it in config bootstrap array
namespace app\components; use Yii; use yii\base\Component; class Aliases extends Component { public function init() { Yii::setAlias('@editor_lang_dir', Yii::getAlias('@webroot').'/scripts/sceditor/languages/'); } }
and inside the configuration file, add 'app \ components \ Aliases' to the bootstrap array
'bootstrap' => [ 'log', 'app\components\Aliases', ],
source share