Hi Brothers ,
Laravel is a popular PHP framework for web development. Knowing the Laravel version of your project is crucial when you're dealing with compatibility issues, updates, or third-party packages. Here's how you can check the Laravel version of your project step-by-step.
Methods to Check Laravel Version
artisan
Command
Laravel's artisan
is a command-line interface tool that makes it easy to perform common tasks. To check the Laravel version:
Open your terminal or command prompt.
Navigate to your Laravel project's root directory.
Run the following command:
php artisan --version
Output Example
Laravel Framework 10.5.2
The composer.json
file in your Laravel project's root directory contains information about the dependencies, including the Laravel framework version.
Open the composer.json
file.
Look for the laravel/framework
entry under the require
section.
Example:
"require": {
"php": "^8.1",
"laravel/framework": "^10.0", ...
}
Here, ^10.0 indicates that the Laravel version is 10.x.
Laravel's core version information is stored in the Application.php
file.
Navigate to the vendor/laravel/framework/src/Illuminate/Foundation/
directory in your project.
Open the Application.php
file.
Look for the VERSION
constant.
Example:
const VERSION = '10.5.2';
This indicates that the Laravel version is 10.5.2.
You can also display the Laravel version directly in your browser.
routes/web.php
file.Route::get('/laravel-version', function () {
return app()->version();
})
Start the Laravel development server
php artisan serve
Visit http://localhost:8000/laravel-version in your browser. You will see the Laravel version displayed.
Checking the Laravel version is simple and can be done using artisan commands, files, or even browser routes. Regularly checking and maintaining your Laravel version ensures compatibility with modern features and packages.
By following the above methods, you'll always know your Laravel version and be ready to handle updates or issues with ease.