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

Question:

I had Laravel version 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 he updated to version 4.2.11 , and these two methods finally appeared in Eloquent 's Builder .

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

How do I know what version of Laravel I'm using (I looked in the source code and couldn't find it)?

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

Answer:

If you run php artisan --version command in your CLI it will show your Laravel version.

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';

Additionally, you can put the code below at the end of your routes.php , so you can go to seudominio.com/laravel-version and check your version:

Route::get('laravel-version', function() {
    $laravel = app();
    return "Your Laravel version is ".$laravel::VERSION;
});
Scroll to Top