Get your next remote job on LaraJobs.
2 contributors Edit on GitHub Laravel

6 ways to check which Laravel version you are running

Table of contents:

6 ways to check which Laravel version you are running

The quickest way to check your Laravel version

The quickest way to check your Laravel version is by using the php artisan --version command.

Knowing which version of Laravel you are running and its specific details are crucial pieces of information, whether you’re planning to upgrade, debug, or simply want to ensure compatibility with a specific feature.

However, there are other methods to get the version of Laravel. Here’s a comprehensive guide with commands that work no matter if you use macOS, any Linux distribution like Ubuntu, Docker or WSL (Windows Subsystem for Linux).

6 ways to check the version of Laravel

Using the php artisan about command

The about command Artisan offers not only displays the Laravel version but also other helpful information about your project such as the version of PHP you’re running on, Composer’s version, cache drivers, etc.

However, it’s important to note that the about command is only available in Laravel version 9.21 or later.

php artisan about
 
Laravel Version ..................................................... 9.43.0
PHP Version ......................................................... 8.1.10
Composer Version ..................................................... 2.4.1

The php artisan about command in Laravel.

Using the –version flag with Artisan

I talked about it in the introduction. If you are using an older version of Laravel, you can still use the --version flag to display the Laravel version.

This is the original method for checking it before the about command was introduced. The --version flag has priority over any Artisan command.

php artisan --version
 
Laravel Framework 9.43.0

Or, using the flag with any other command:

php artisan make:model --version
 
Laravel Framework 9.43.0

Using the version() method

The app() helper will give you access to many information, such as the Laravel version you are running. Try this simple code below:

// 9.43.0
app()->version();

You could use it in a custom dashboard you created:

<ul>
<li>PHP: {{ phpversion() }}</li>
<li>Laravel: {{ app()->version() }}</li>
</ul>

Via Composer in your terminal

Composer offers a handy command to check the version of a specific dependency. Run:

composer show laravel/framework

You will get an incredibly report about this dependency.

name : laravel/framework
descrip. : The Laravel Framework.
keywords : framework, laravel
versions : * v10.26.2
type : library
license : MIT License (MIT) (OSI approved) https://spdx.org/licenses/MIT.html#licenseText
homepage : https://laravel.com
source : [git] https://github.com/laravel/framework.git 6e5440f7c518f26b4495e5d7e4796ec239e26df9
dist : [zip] https://api.github.com/repos/laravel/framework/zipball/6e5440f7c518f26b4495e5d7e4796ec239e26df9 6e5440f7c518f26b4495e5d7e4796ec239e26df9
path : /Users/benjamin/Projects/benjamincrozat/vendor/laravel/framework
names : laravel/framework, psr/container-implementation, psr/simple-cache-implementation, illuminate/auth, illuminate/broadcasting, …

The command composer show in action to check the version of Laravel.

In the composer.json and composer.lock files

In your composer.json, you will be able to get the minimum version of Laravel your project is locked on:

"require": {
"php": "^8.0.2",
"guzzlehttp/guzzle": "^7.2",
"laravel/framework": "^9.19",
"laravel/sanctum": "^3.0",
"laravel/tinker": "^2.7"
}

As you can see, this project is locked on Laravel 9.19 or earlier.

But this might not be enough. Since versions earlier than 9.19 are supported, you project might use Laravel 9.32 or even 9.484843!

Instead, search for “laravel/framework” inside your composer.lock file to get the exact Laravel version that’s installed on your project :

{
"name": "laravel/framework",
"version": "v9.43.0",
"source": {
"type": "git",
"url": "https://github.com/laravel/framework.git",
"reference": "2ca2b168a3e995a8ec6ea2805906379095d20080"
}
}

In the source code

Open your favorite code editor and search for vendor/laravel/framework/src/Illuminate/Foundation/Application.php. The exact version of Laravel you are using is written in the VERSION constant.

class Application extends Container implements ApplicationContract, CachesConfiguration, CachesRoutes, HttpKernelInterface
{
const VERSION = '9.43.0';
}

This is actually the constant app()->version() uses. 😀

public function version()
{
return static::VERSION;
}
Benjamin Crozat

Written by Benjamin Crozat
and 1 contributor

Indie hacker, blogger, and AI enthusiast building things with the TALL stack. 🔥

Follow me on:

Many thanks to Mauricio Cabral for the help!

Recommended articles

Laravel 10 is out! Here are every new features and changes. Laravel 10 is out! Here are every new features and changes.

Laravel 10 has been released on February 14, 2023. Let's dive into every relevant new features and changes.

Modified on Nov 2, 2023

6 ways to check which version of PHP you are running 6 ways to check which version of PHP you are running

Discover how to check your version of PHP using phpinfo(), your terminal, Laravel's welcome page, or a Laravel Artisan command.

Published on Sep 2, 2023

Laravel 9: the mindful upgrade guide Laravel 9: the mindful upgrade guide

I show you how to upgrade your Laravel 8 project to version 9 and help you decide whether the return on investment is worth it.

Published on Feb 4, 2023

A complete history of Laravel's versions (2011-2023) A complete history of Laravel's versions (2011-2023)

What's the current version of Laravel? Is there any LTS release you can rely on? And what about the history of the framework? Let's find out!

Modified on Oct 15, 2023

Gold sponsors New

  • Wire Elements
    Beautiful handcrafted Livewire components.
    Check site
Your business here

Partners

If you buy from one of my partners below, I will be compensated at no cost to you. These are services I use or used, and 100% stand behind.

  • Scalable and reliable VPS hosting.
    Bonus: $200 of free credits
    Check site
  • The Google Analytics alternative without compromise.
    Free trial: 30 days
    Bonus: $10 off your first invoice
    Check site
  • Flare
    Track PHP and JavaScript errors in one place.
    Free trial: 10 days
    Check site
  • Keep track of your Google rankings.
    Free trial: 7 days
    Promo code: WELCOME30
    Check site
- / -