- 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
php artisan -v
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(); });
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.
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
app()->version()
Leave a reply