Posts Learn Components Snippets Categories Tags Tools new About
/

How to Check Laravel Version (Full Guide)

Get to know the ways to check Laravel versions in this code snippets

Created on Nov 13, 2021

6 views

There are several ways to check Laravel versions and they are through
  • command line
  • programmatically from code
  • composer.json file
  • helper methods

Method 1: Laravel Check Version from Command Line


To check version from the command line you can use the command below.
php artisan --version
or the slightly shorter is:
php artisan -v
Laravel Check Version Using Command Line

Method 2: Laravel Check Version Programmatically from code


To check the version from Laravel code you can define your code below. Create a route in web.php and then call the "app()->version()" helper.
<?php

Route::get('get-laravel-version', function () {
    app()->version();
});
Laravel Get Version Programmatically

Method 3: Laravel Check Version Via Composer.json


The 3rd method is to check from the composer.json file itself, you can inspect the Laravel version.
Laravel version from composer.json

Method 4: Laravel Check Version Via Helper methods


This is like the 2nd method but you can easily call it from within the tinker command.
php artisan tinker
Then from the interactive shell, you can run the helper below.
app()->version()

If you like our tutorial, do make sure to support us by being our Patreon or buy us some coffee ☕️

new

PostSrc Code Components

Collection of Tailwind CSS components for everyone to use. Browse all of the components that are right for your project.

View Components
)