Skip to main content

How to Check Laravel Version

If you’re a regular Laravel user, you know that one of the best things about the framework is its constant evolution. New features are frequently added and improvements are constantly being made, so it’s always good to stay up to date. Updating your Laravel project is usually pretty straightforward – you simply run the composer update command. However, sometimes you might need to access a specific version number,.

Have you ever been in a situation where you needed to know what version of Laravel your application is running on, but you didn’t know how? In this blog post, we’re going to show you two different ways that you can check for the Laravel version. We’ll also show you how to determine whether your application is up-to-date or not.

Why do you need to check the Laravel version?

There are a few reasons why you might need to know what version of Laravel your application is running.

  • Compatibility issues: If you are running an older version of Laravel, there may be some compatibility issues with newer versions of the framework. For example, if you are running Laravel 4.2 and try to use a feature that was introduced in Laravel 5.0, you may run into some problems.
  • Incorrect code functionality: If you are not using the most up-to-date version of Laravel, your application may not be working as intended. For example, a bug that was fixed in a later version of Laravel may still be present in your application if you are not using the latest release.
  • Security vulnerabilities: Older versions of Laravel may have security vulnerabilities that have been patched in more recent releases. If you are not using the most up-to-date version of Laravel, your application may be at risk.
  • Bug report: For example, if you’re ever submitting a bug report, it’s helpful to know which version you’re using. That way, the maintainers can check to see if the bug has already been fixed in a newer release.
  • Support: Knowing the Laravel version can be helpful when trying to find answers to questions online. If you ever come across a blog post or Stack Overflow answer that doesn’t quite work for your version, you’ll at least know how far off it is and whether it’s worth trying to make it work or not.

Checking the Laravel Version

Use Artisan command

Laravel has a command-line interface named Artisan. This handy tool can help us check the current Laravel version we are running.

In your terminal, enter the following:

php artisan --version

View Application.php

You can also check for the Laravel version by looking at the file located at /vendor/laravel/framework/src/Illuminate/Foundation/Application.php. The contents of this file start with the following:

class Application extends Container implements ApplicationContract, HttpKernelInterface
     * The Laravel framework version.
     * @var string
    const VERSION = '5.8.38';

Use helper class

In such cases, you can use the app()->version() command to easily retrieve the current version number. Simply insert the following statement into your controller or similar:

$version = app()->version(); 
echo $version; // outputs "5.8.38"

And that’s it! This quick and easy little tip can be really useful when you need it.

Check the composer.json file

The version of your Laravel project lies right in the composer.json file. You will locate the composer.json file in the root directory of your project, for example, myApp/composer.json. The content of the file looks like this: 

"require": {
        "php": "^7.1.3",
        "fideloper/proxy": "^4.0",
        "laravel/framework": "5.8.*",
        "laravel/passport": "7.5.1",
        "laravel/sanctum": "^2.8",
        "laravel/tinker": "^1.0",
        "spatie/laravel-permission": "^3.13"

As you can see, the version of your project is defined in the required section. The number right after the double colon is the version number of your project.

By continuing to use the site, you agree to the use of cookies.