Laravel is the primary framework that I get to work with on a regular basis, and finding out the version of Laravel that I am using is very important for compatibility as well as troubleshooting. Here are the straightforward steps that will show you the Laravel version.
If you want to easily check what version of your Laravel is, the best and quickest way is to run the artisan command. Here is how I do it:
Go to your terminal or command prompt window.
Then, find the Laravel root folder and go there.
Key in the exact command below and then hit Enter:
php artisan --version
A message will show you the succeeding Laravel framework version you are using.
One other way for me to find the Laravel version is looking at the "composer.json" file:
Begin by opening the Laravel project in a text editor or file explorer.
Then, you will have to get into the root directory of your new Laravel project to find the "composer.json" file you need. It seems like a good place to look
View the content and then look for the "laravel/framework" entry under the "require" section.
{ "name": "laravel/laravel", "type": "project", ... "require": { "php": "^8.3", "laravel/framework": "^10.10", ... }, ...
The version number will be indicated there.
If I just want to find out the Laravel version with the use of the PHP code:
echo app()->version();
To display the version number, I can use this method somewhere in my code.
Being able to tell whether you are running the most recent version of Laravel is a very basic but extremely important skill. I hope these techniques make it much easier to tell which version of Laravel you are using. Remember that managing your app well means more than just writing code; you also need to be aware of your development environment. These methods make it easy and quick to find out which version of Laravel you are working with. This makes development go more smoothly and improves your overall development experience, especially if you're figuring out some compatibility and debugging issues.