How to know Laravel version and where is it defined?

Laravel

Laravel Problem Overview


How to know Laravel version and where is it defined?

Is Laravel version is defined inside my application directory or somewhere in global server side directory?

UPDATE

Sorry, the main question is where the version is defined? Where does

php artisan --version

takes it's answer?

UPDATE 2

The goal is to investigate, who (of us) has changed Laravel version on our site. Could it be changed by github repository edition only? Or server write access was also required?

Laravel Solutions


Solution 1 - Laravel

run php artisan --version from your console.

The version string is defined here:

https://github.com/laravel/framework/blob/master/src/Illuminate/Foundation/Application.php

/**
 * The Laravel framework version.
 *
 * @var string
 */
 const VERSION = '5.5-dev';

Solution 2 - Laravel

  1)  php artisan -V

  2)  php artisan --version

AND its define at the composer.json file

"require": {
        ...........
        "laravel/framework": "^6.2",
        ...........
    },

Solution 3 - Laravel

If you want to know the specific version then you need to check composer.lock file and search For

> "name": "laravel/framework",

you will find your version in next line

> "version": "v5.7.9",

Solution 4 - Laravel

If you want to know the user version in your code, then you can use using app() helper function

app()->version();

It is defined in this file ../src/Illuminate/Foundation/Application.php

Hope it will help :)

Solution 5 - Laravel

CASE - 1

Run this command in your project..

php artisan --version  

You will get version of laravel installed in your system like this..

enter image description here

CASE - 2

Also you can check laravel version in the composer.json file in root directory.

enter image description here

Solution 6 - Laravel

##Step 1:

go to: /vendor/laravel/framework/src.Illuminate/Foundation:

go to: /vendor/laravel/framework/src.Illuminate/Foundation

##Step 2:

Open application.php file

Open application.php file

##Step 3:

Search for "version". The below indicates the version.

Open application.php file

Solution 7 - Laravel

Run this command in your project folder location in cmd

php artisan --version

Solution 8 - Laravel

Yet another way is to read the composer.json file, but it can end with wildcard character *

Solution 9 - Laravel

In your Laravel deployment it would be

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

to see who changed your Laravel version look at what's defined in composer.json. If you have "laravel/framework": "5.4.*", then it will update to the latest after composer update is run. Composer.lock is the file that results from running a composer update, so really see who last one to modify the composer.json file was (hopefully you have that in version control). You can read more about it here https://getcomposer.org/doc/01-basic-usage.md

Solution 10 - Laravel

You can also check with composer:

composer show laravel/framework

Solution 11 - Laravel

Multiple way we can find out laravel version such as,

Using Command

php artisan --version
  or
php artisan -v

From Composer.json

From Vendor Directory

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

Solution 12 - Laravel

If you're like me and want to show the Laravel version and app version on the footer you can create a Blade directive in AppServiceProvider. Blade directives are placed in the boot method of the AppServiceProvider and example code may like something like


Blade::directive('laravelVersion', function () {
    return "<?php echo app()->version(); ?>";
});

then in the blade template, you call it like @laravelVersion and it will show the current laravel version.

If you want, you can read more about blade directive here

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionDimsView Question on Stackoverflow
Solution 1 - Laraveluser320487View Answer on Stackoverflow
Solution 2 - LaravelParth kharechaView Answer on Stackoverflow
Solution 3 - Laravelankit patelView Answer on Stackoverflow
Solution 4 - LaravelVikashView Answer on Stackoverflow
Solution 5 - LaravelRohit TagadiyaView Answer on Stackoverflow
Solution 6 - LaravelJyotirmoy BhattacharjeeView Answer on Stackoverflow
Solution 7 - LaravelKnc MoBoView Answer on Stackoverflow
Solution 8 - LaravelBartłomiej SobieszekView Answer on Stackoverflow
Solution 9 - LaravelStan QuinnView Answer on Stackoverflow
Solution 10 - LaravelJsowaView Answer on Stackoverflow
Solution 11 - LaravelMd.Emran SikderView Answer on Stackoverflow
Solution 12 - LaravelTeodorView Answer on Stackoverflow