How to Check Laravel Version via CLI and Application File

Last updated on by Digamber
In this tutorial, we will look at how to check the laravel version using a command-line interface, and we also have a look at the project files to identify the find out the laravel version.

How To Check The Laravel Version?

Being a Laravel developer, we must know this PHP framework offers two easy methods to check the version of our Laravel application.

  • Check Laravel version using the command.
  • Check Laravel version using the Laravel project files.

Check Laravel Version using the Command

The easiest way is to check the Laravel version is using the command that we have mentioned the command below.

You need to execute this command through your terminal window. Get inside your Laravel project and execute the command to check Laravel.

php artisan --version

#or 

php artisan -v

You will get the following output on your terminal window.

Laravel Framework 7.13.0

Check Laravel Version in Application File

This method is a little bit different than the method we used in the previous step. We have to navigate to the Application file to check the Laravel version through the file. Following is the full root that will take you to the Application.php file.

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

You can see the version number of Laravel at around line no 36, and the version is defined in the const VERSION = ‘….’.

<?php

namespace Illuminate\Foundation;

...............................
...............................
...............................
...............................
...............................

class Application extends Container implements ApplicationContract, CachesConfiguration, CachesRoutes, HttpKernelInterface
{
    /**
     * The Laravel framework version.
     *
     * @var string
     */
    const VERSION = '7.13.0';

...............................
...............................
...............................
...............................
...............................

Conclusion

This was it, easy is in it
Finally, we have completed this quick tutorial about finding out the Laravel version using the command line tool and also through the Application.php file. It’s upto you which process is the easiest for you.