How can I echo the version of the current Laravel version in php using the view?

前端 未结 13 1113
青春惊慌失措
青春惊慌失措 2021-01-30 10:01

I don\'t want to check my Laravel version in the command prompt (php artisan --version), but in the view itself.

Like this:



        
相关标签:
13条回答
  • 2021-01-30 10:43

    One More way. Just go to the root directory of the project.
    Hit below commands

    php artisan tinker
    App::VERSION()
    

    Tinker is amazing.

    0 讨论(0)
  • 2021-01-30 10:44
    global $app;
    echo $app::VERSION;
    
    0 讨论(0)
  • 2021-01-30 10:45
    • ubunut 16.04
    • php 7.0.33
    • Laravel Framework 5.5.48

      php artisan --version
      

      Artisan -Artisan is the name of the command-line interface included with Laravel. It provides a number of helpful commands for your use while developing your application. It is driven by the powerful Symfony Console component.

    for more-

        php artisan list
    
    0 讨论(0)
  • 2021-01-30 10:46

    Another way that works throughout your app - Blade templates or otherwise - is to use:

    app()->version()
    
    0 讨论(0)
  • 2021-01-30 10:48

    Here is an easiest way to check it manually from the folder

    Go to project folder

    D:\xampp\htdocs\your-project-folder\vendor\laravel\framework\src\Illuminate\Foundation\Application.php

    const VERSION = '5.2.45'; //version of laravel

    This is the another way to check it.

    If you don't want to check using this command php artisan --version

    0 讨论(0)
  • 2021-01-30 10:49

    There are different ways of coding, I found multiple ways to current version find in Laravel

    View current Laravel version through Blade Templates, there are many ways:

    First way

    {{ App::VERSION() }} 
    

    Second way

    <?php
         echo $app::VERSION;
    ?>
    

    Third way

    <?php
      $laravel = app();
      echo $laravel::VERSION;
    ?>
    

    Also, the Laravel version installed can be checked in the command line using the following command :

    php artisan --version
    
    0 讨论(0)
提交回复
热议问题