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

Asked

Viewed 15,531 times

10

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 the whereDoesntHave and the doesntHave.

When executing a composer update he upgraded to the 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 the version of Laravel I’m using (I searched the source code and did not find)?

Is there any way to do that via Composer or have some file on Laravel 4 that stores the current version (in a comment or something like)?

2 answers

17


If you run the command php artisan --version in his CLI he will show the version of his Laravel.

Or else 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, set as a Constant:

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

Additionally, you can put 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;
});

7

You can use Composer for this too:

composer show laravel/framework

In the first 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

Browser other questions tagged

You are not signed in. Login or sign up in order to post.