Benjamin Crozat The web developer life

Check Laravel version: 4 easy ways

Benjamin Crozat Benjamin Crozat2 minutes read

Before you start reading this article, did you know 76 persons subscribed to my newsletter?

Join them and enjoy free content about the art of crafting websites!

Check Laravel version: 4 easy ways
Table of contents

To check which Laravel version you are using, the quickest way to do it is to use the php artisan --version command.

But there are multiple other ways to do it. Let’s review them.

The about command

The about command gives you the Laravel version you are running as well as a lot of other information about your project.

php artisan about
 
Environment ................................................................
Application Name ........................................... Benjamin Crozat
Laravel Version ..................................................... 9.29.0
PHP Version ......................................................... 8.1.10
Composer Version ..................................................... 2.4.1
Environment .......................................................... local
Debug Mode ......................................................... ENABLED
URL .................................................... benjamincrozat.test
Maintenance Mode ....................................................... OFF
 
Cache ......................................................................
Config .......................................................... NOT CACHED
Events .......................................................... NOT CACHED
Routes .......................................................... NOT CACHED
Views ............................................................... CACHED
 
Drivers ....................................................................
Broadcasting ........................................................... log
Cache ................................................................ redis
Database ............................................................. mysql
Logs ........................................................ stack / single
Mail .................................................................. smtp
Queue ................................................................. sync
Session .............................................................. redis

The –version flag

Before Laravel blessed us with the about command, it was also possible to check your project’s Laravel version like so:

php artisan --version
 
Laravel Framework 9.29.0

The app() helper

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

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

Check inside 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.0 or earlier.

But this might not be enough. 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.30.0",
"source": {
"type": "git",
"url": "https://github.com/laravel/framework.git",
"reference": "2ca2b168a3e995a8ec6ea2805906379095d20080"
}
}

Other posts to read

Here are the best GDPR-compliant Google Analytics alternatives to help you avoid the GDPR penalty and keep your users safe.

A soft delete in Laravel allows you to prevent mistakes by not removing sensitive data from your database right away.

Whether PHP is dead or not is a matter of numbers, not opinions. I will provide you with essential statistics that will lead you to make better decisions.

Debugging requires dissecting everything. Here's a list of all the one-line of code built-in ways to print arrays in PHP.

When in doubt, clear the cache. In this article, you'll learn about how to clear every cache Laravel uses.

Learn why the "Using $this when not in object context" error happens, and let me show you the only way to fix.

Learn why the "Invalid argument supplied for foreach()" warning happens, and let me show you multiple ways to fix it.

Are you looking for the best web hosting for Laravel projects and all budgets? I've got you covered. Here are the best I found.

Redirects in PHP are simple. I will guide you step by step and show you how to dodge some traps. Finally, we'll learn the nuance between 301 and 302 redirects.

AI is a trending topic in the programming space. It enables developers to do incredible things, and many startups build products around it.