There are several ways to find the laravel version which has been used for application development. We will see all possible ways to find laravel version of an application.
Inside this article we will see and discuss 4 ways to find laravel version of any laravel application. This article will clear you about How to find laravel version in application in a very easy and detailed way.
Why we need to know Laravel Version?
If any new developer is working on someone’s project which has been created in Laravel, first developer should know in which version it has been developed so that they will take care of next developments.
Learn More –
- API Authentication using Laravel 8 Sanctum Tutorial
- Bar Chart Integration with Laravel 8 Tutorial Example
- Barcode Generator in Laravel 8 Tutorial
- Bootstrap Growl jQuery Notification Plugin to Laravel 8
Let’s get started.
Laravel Installation
We will create laravel project using composer. So, please make sure your system should have composer installed. If not, may be this article will help you to Install composer in system.
Here is the command to create a laravel project-
composer create-project --prefer-dist laravel/laravel blog
To start the development server of Laravel –
php artisan serve
URL: http://127.0.0.1:8000
Assuming laravel already installed inside your system.
Methods To Find Laravel Version
Here, we will discuss about 4 ways to find laravel version in any laravel application.
- By Artisan Command
- Using Composer.json
- By Using global helper function of Laravel
- By Global Application Helper file
Let’s see all methods in action.
By Artisan Command
Open project in terminal and run this command into it.
$ php artisan -V OR $ php artisan --version
Using Composer.json
When you install laravel setup, you should see you have a file with name composer.json at application root.
Open file and search for “require”
You will see inside require object you have a property something like this –
"laravel/framework": "^8.40",
By Using global helper function of Laravel
In laravel, we have a global helper function provided for application as app()
By using this helper function we can call a version() method of it.
$version = app()->version();
Let’s create a small program which returns laravel version.
Open web.php file from /routes folder.
//... Route::get("get-version", function(){ $version = app()->version(); dd($version); }); //...
Start development server –
$ php artisan serve
URL – http://127.0.0.1:8000/get-version
By Global Application Helper file
This method is quite long to find laravel version. Because we need to find it into deeper file hierarchy.
We need to go inside Application.php which is a class file and also it’s a global application helper class.
File Path –
/vendor/laravel/framework/src/Illuminate/Foundation
We hope this article helped you to learn How To Find Laravel Version in Application in a very detailed way.
If you liked this article, then please subscribe to our YouTube Channel for PHP & it’s framework, WordPress, Node Js video tutorials. You can also find us on Twitter and Facebook.