Yii 2.0: Yii 2 list of path aliases available with default basic and advanced app.

39 followers

If you are coming over from Yii 1.x to Yii 2, and already read this guide, you may note that namespaces are very important in Yii 2 to identify classes. But do you know the list of seeded path aliases that come shipped with a basic or advanced app? Here is my attempt to list them.

Path Aliases List

Yii2 Basic App

  • @app: Your application root directory
  • @vendor: Your vendor directory on your root app install directory
  • @runtime: Your application files runtime/cache storage folder
  • @web: Your application base url path
  • @webroot: Your application web root
  • @tests: Your console tests directory

Yii2 Advanced App

  • @app: Your application root directory (either frontend or backend or console depending on where you access it from)
  • @vendor: Your vendor directory on your root app install directory
  • @runtime: Your application files runtime/cache storage folder
  • @web: Your application base url path
  • @webroot: Your application web root
  • @tests: Your console tests directory
  • @common: Alias for your common root folder on your root app install directory
  • @frontend: Alias for your frontend root folder on your root app install directory
  • @backend: Alias for your backend root folder on your root app install directory
  • @console: Alias for your console root folder on your root app install directory

Total 1 comment

#18756 report it
bis at 2014/12/29 02:40pm
Nice summary, but

@app is not "application root directory" but current application's (frontend/backend/console) root directory in advanced template, this makes all subsequent "under @app" remarks incorrect. Was it the cause of these thumb-downs?

Leave a comment

Please to leave your comment.