🔍 How to Check Laravel Version

Whether you're debugging, upgrading, or simply working on an existing Laravel project, knowing the Laravel version is a crucial first step. This blog will walk you through all the methods to check your Laravel version quickly and reliably.


🧾 Why It’s Important to Know Your Laravel Version

  • ✅ To check compatibility with PHP or other packages
  • ✅ To update or debug based on documentation
  • ✅ To ensure you're following the correct Laravel practices


🛠️ Method 1: Using Artisan Command

The easiest way is to use the built-in Artisan CLI.

📌 Step:

Open your terminal and navigate to the root directory of your Laravel project, then run:

php artisan --version

📤 Output:

Laravel Framework 12.1.0

🛠️ Method 2: Using composer.json File

You can also check the Laravel version by viewing the dependencies listed in the composer.json file.

📌 Step:

Open composer.json in your project root and find the laravel/framework line under the require section:

"require": {
"laravel/framework": "^12.0",
...
}

📍 Note: This shows the version constraint, not the exact installed version.


🛠️ Method 3: Check composer.lock File (Exact Version)

To get the exact installed version, check the composer.lock file.

📌 Step:

Search for laravel/framework in composer.lock:

{
"name": "laravel/framework",
"version": "v12.1.0",
...
}

🛠️ Method 4: Using PHP Code (Programmatically)

You can check the Laravel version via code using the Application class.

📌 Code Example:

use Illuminate\Foundation\Application;
echo Application::VERSION;

Place this in a route or controller to output the version:

Route::get('/laravel-version', function () {
return app()->version();
});

🛠️ Method 5: Laravel Version in the bootstrap/cache Folder (Optional)

Some Laravel versions cache the framework version in compiled files — though not always visible or accurate. Stick with the above four methods for reliability.

Post a Comment

Previous Post Next Post

Contact Form