How to check laravel application version using CLI or file

Laravel is a popular framework built with PHP. While working on an existing project or implementing new packages we need to check particular package is compatible with Laravel framework's version or not. We have to decide based on Laravel version.

In this tutorial, we will teach you how to check Laravel framework's version using the below methods:

  1. Check Laravel Version Using CLI
  2. Check Laravel Version In File

Both methods return the same output on any operating system. You can use a command prompt or terminal to check Laravel version using CLI or you can navigate to the particular file using file manager and check it.

Check Laravel Version Using CLI

Laravel has its in-built command line tool artisan to handle CLI operations. Artisan is a useful and very powerful command line tool pre-loaded with Laravel framework. As you know artisan is used for many tasks like creating model, migration or controller or clearing cache, and many more.

To check Laravel version using Artisan, first of all open terminal or command prompt based on your OS. Now navigate to root directory or your application and execute below command:

php artisan --version

It will show Laravel framework version in console like below output :

Laravel Framework 8.83.6

Check Laravel Version In File

Sometimes working on a server or by signing in non-root user you don't have terminal access to application directory. In such cases, you can use this method. Here, we will check the version using framework files downloaded while creating new application.

Open the file manager and navigate to the root directory of application. Find and open below file :

./vendor/laravel/framework/src/Illuminate/Foundation/Application.php

Open this file in any text editor and search for VERSION. Here, you will find a constant variable by VERSION name and its value contains Laravel application's version like below example :

/**
 * The Laravel framework version.
 *
 * @var string
 */
const VERSION = '8.83.6';

Mostly, it is the first variable defined in application class. It will show same version as a command line.

Conclusion

In this article, you have learned to check Laravel framework version using a terminal or command line as well as manually check by files. It will be helpful to know the version of Laravel while working on any application.