Spread the love

To find the installed laravel version in command line we can use artisan command and to find the laravel version in application code we can use app method. In this article i will show you to get the version of laravel version in both ways using command line and in code.

Sometimes in our application we need to find the laravel version for installing the packages or to make some logic of application in behalf of application version.

Laravel version in command line

To get the version in command line we can use artisan as below

php artisan --version

above command will output as below

Laravel Framework 8.61.0

Laravel version in application code

To get the version in application code line we can use app method of laravel

echo  "Installed Laravel version is ".app()->version();

above command will output as below

Installed Laravel version is 8.61.0

Composer.json file to get the version of laravel

You can find the laravel version in composer.JSON file as below

{
    "name": "laravel/laravel",
    "type": "project",
    "description": "The Laravel Framework.",
    "keywords": ["framework", "laravel"],
    "license": "MIT",
    "require": {
       ...
        "laravel/framework": "^8.54",
        
    },
   
}

You can also find in vendor folder and go to /vendor/laravel/framework/src/Illuminate/Foundation/Application.php 


class Application extends Container implements ApplicationContract, CachesConfiguration, CachesRoutes, HttpKernelInterface
{
    /**
     * The Laravel framework version.
     *
     * @var string
     */
    const VERSION = '8.61.0';

Also Read : How to Install multiple versions of PHP?

Leave a Reply