How to find out the version of Laravel installed in my project?

8

I was with the version of Laravel 4.2.7 installed on my computer.

I missed two important methods in Illuminate\Database\Eloquent\Builder , which is whereDoesntHave and doesntHave .

When running a composer update it upgraded to version 4.2.11 , and these two methods finally appeared in Builder of Eloquent .

From this problem, I realized the importance of knowing which version of Laravel I'm working on.

How do I know which version of Laravel I'm using (I looked in source code and did not find it)?

Is there any way to do this via Composer or do you have any files in Laravel 4 that saves the current version (in a comment or something like this)?

    
asked by anonymous 03.02.2015 / 20:19

2 answers

14

If you run the php artisan --version command on your CLI it will display the version of your Laravel.

Or you can open the file vendor\laravel\framework\src\Illuminate\Foundation\Application.php , you will see the version of your installation at the top of the file, defined as a constant:

/**
     * The Laravel framework version.
     *
     * @var string
     */
    const VERSION = '4.0.11';

In addition, you can by the code below at the end of your routes.php , then you can access seudominio.com/laravel-version and check your version:

Route::get('laravel-version', function() {
    $laravel = app();
    return "Your Laravel version is ".$laravel::VERSION;
});
    
03.02.2015 / 20:30
5

You can use Composer for this too:

composer show laravel/framework

In the first few lines you can check the installed version:

λ composer show laravel/framework
name     : laravel/framework
descrip. : The Laravel Framework.
keywords : framework, laravel
versions : * v5.1.31
    
01.08.2016 / 03:16