4 Ways To Get The Laravel Version


4 Ways To Get The Laravel Version. In this post, we find Laravel version 4 different methods will see the demo.

We need to work on which version of the website many times, for which we can't find many websites of many times, but we do get it easily, then in this tutorial, we will learn how to pot Laravel Find out


4 Ways To Get The Laravel Version - PHP Coding Stuff
Method 1 – Using PHP Artisan

This command is varied easily to use. Old PHP artisan command and in this case, open the command prompt at the projects root directory, and execute the following command –

php artisan --version


For example, these outputs for my project –

Laravel Framework 8.16.1

Method 2 – Checking The Composer.json File

This Example very easy-to-find Laravel version. When we create a new project, we get a composer.json file in it, through that composer.json file we can also check the version.

You Can Go composer.json file in the root directory of your project, for example, myApp/composer.json.

In this file, you will see something like the following -

{
    "name": "laravel/laravel",
    "type": "project",
    "description": "The Laravel Framework.",
    "keywords": [
        "framework",
        "laravel"
    ],
    "license": "MIT",
    "require": {
        "php": "^7.3|^8.0",
        "fideloper/proxy": "^4.2",
        "fruitcake/laravel-cors": "^2.0",
        "guzzlehttp/guzzle": "^7.0.1",
        "laravel/framework": "^8.16.1",  <------- Your Laravel Version
        "laravel/tinker": "^2.0"
    },
Method 3 – Using The Global Application Helper Class

In this method, your controller or similar you can access the global Application class by using the following statement –

$version = app()->version();

dd($version); // outputs "8.16.1"
Method 4 – Opening The Global Application Helper Class File

This method is very long, in this case, you will go to the project folder inside your own and check where the version is given to check, see below example

So, to see the version number, locate the Application.php file in the following path

yourRootProjectDirectory/vendor/laravel/framework/src/Illuminate/Foundation/Application.php


I hope it can help you...

Leave a Reply

Your privacy will not be published. Required fields are marked *

We'll share your Website Only Trusted.!!

close