How to Get Yii2 Framework Version Number

By:   –  Last updated:   –  #yii2 ·  #php

Code Theme [Dark]

Content Overview [Hide]

You may need to know version number of the Yii2 framework currently used in your project. There are two methods to do this.

1 Yii Command Line

Go to root folder of your Yii2 framework. You can see a yii file there. A version number will be printed by executing it in command line.

$ ./yii

This is Yii version
# ... balabala ...

Note: You should run yii.bat file under the same folder if you are using Windows system.

2 Yii API

$version = Yii::getVersion();

Above getVersion() function will return current version of the Yii framework.