How to Check the Laravel Version of Your Project

How to Check the Laravel Version of Your Project

Laravel, a popular PHP framework, is known for its simplicity and elegance in web development. With each new release, Laravel introduces enhancements, bug fixes, and exciting features. Developers must know which version of Laravel they are working with, as this information can affect the compatibility of packages, libraries, and the overall stability of their applications. This article will explore various methods to determine the Laravel version installed on your system.

You may want to revisit The Laravel Directory Structure for an overview of the key directories and their roles within a Laravel project

Using the Laravel Artisan Command

One of the most straightforward ways to check the Laravel version is by using the Laravel Artisan command-line tool. Here’s how you can do it:

Using your terminal or command prompt, navigate to your Laravel project’s root directory and run the following command:

php artisan --version

This command will display the Laravel version of your project.

Laravel Framework 10.3.0

Checking the Laravel Framework Application File

Laravel stores information about its version in a file Application.php within the framework’s core directory. You can use the cat command to view the contents of this file.

Navigate to your Laravel project’s root directory. Use the cat command to display the Laravel version:

cat vendor/laravel/framework/src/Illuminate/Foundation/Application.php | grep "const VERSION"

This command will output the Laravel version to the console.

const VERSION = '10.3.0';

Checking the Composer.json File

Another way to determine the Laravel version is by inspecting the composer.json file in your Laravel project’s root directory. Composer uses the composer.json file to specify project dependencies.

Navigate to your Laravel project’s root directory. Open the composer.json file, look for the “require” section, and find the entry for Laravel which specifies the version installed.

    "require": {
        "php": "^8.1",
        "laravel/framework": "^10.0",
    }

In this case, Laravel version 10.0 is installed.

Conclusion

Knowing which version of Laravel is installed in your project is crucial for maintaining compatibility with packages and libraries, and keeping your application up-to-date with the latest features and security patches. By using the Laravel Artisan command, inspecting the Application.php file, or checking the composer.json file, you can easily determine the Laravel version you are working with. This information will help you make informed decisions when developing and maintaining your Laravel applications.

Boost your Laravel apps with our specialized Laravel Hosting. Experience faster speeds for your Laravel applications and websites thanks to NVMe storage, server protection, dedicated resources, and optimization tools.

check mark99.99% Uptime check markFree SSL check markDedicated IP Address check markDeveloper Tools

Laravel Hosting

Derrell Willis
Derrell Willis Manager, Developer Relations

More Articles by Derrell

Was this article helpful? Join the conversation!