How to check Laravel version of our application

Sometimes we require to know the exact version of our Laravel application. well, there are multiple ways how to check the laravel version and you can use the one that fits your needs in a different situation.

Check Laravel Version in vendor File

if you are not familiar with CLI or you may not have access to the server-hosted Laravel applications terminal In that case, you can simply view the Laravel version in the following file. 

First, go to the Laravel web root directory and open the below file.

application root directory > vendor/laravel/framework/src/Illuminate/Foundation/Application.php

Check the Laravel version via CLI (Command Line Interface)

Artisan is a powerful command-line interface included with Laravel. just pen the command line terminal on your system and go to the  Laravel application directory. Then enter the following PHP artisan command to check the Laravel version. well, This is the easiest way if you are familiar with artisan commands.

php artisan -v   

or 

 php artisan --version

Get the Laravel version using the app() helper function

 As we already seen in the first point that we can see the laravel version in the vendor application.php file, now we will access that constant in the blade file via the app() helper.  jus open your blade file and execute the below code

 {{app()->version()}}

Check the Laravel version using tinker

 if you don't want to create any route or blade file this option is useful for you. just open CLI and type

 php artisan tinker

 then type the below command it will return laravel current version that you are using in your application.

 app()->version()

List for checking laravel versions in different situations using different ways:

        
        //check the laravel version via the command line
php artisan -v
//or
php artisan --version

//check the laravel version via the blade file

//check the composer version via the command line
composer -v
//or
composer --version

//check the PHP version via the command line
php -v
//or
php --version
{{ app()->version() }}


//check the laravel version via Command line using tinker
php artisan tinker
//then
app()->version()
        
    

Leave a comment