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

前端 未结 13 1112
青春惊慌失措
青春惊慌失措 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:30

    Only for a specific Project Folder to know the Laravel version of that project on CLI

    $  php artisan --version
    

    remove $ while copying only for representation purpose

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

    In Laravel's Blade templates:

    {{ App::VERSION() }}
    

    Note that this is tested in 5.3x

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

    This is the way how to see laravel version in command explorer:

    php artisan --version
    
    0 讨论(0)
  • 2021-01-30 10:35

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

    1st way to show,

     {{ App::VERSION() }}
    

    2nd way,

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

    3rd way,

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

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

        php artisan --version
    
    0 讨论(0)
  • 2021-01-30 10:40

    you can use this code in routing file of your laravell installation

     $app->get('/', function () use ($app) {
    return $app->version();
    }); 
    

    On view you will get installed version of laravell.

    0 讨论(0)
  • 2021-01-30 10:41
    $laravel = app();
    $version = $laravel::VERSION;
    
    0 讨论(0)
提交回复
热议问题