Home  >  Q&A  >  body text

How to display execution time in Laravel page?

With laravel-debugbar installed, you can count the execution time of PHP+SQL, which is very useful. Now there is a requirement to display the execution time on each page. After searching, there is no ready-made solution.

How to call laravel-debugbar?

Laravel Debugbar

https://github.com/barryvdh/laravel-debugbar

This is a package to integrate PHP Debug Bar with Laravel 5. It includes a ServiceProvider to register the debugbar and attach it to the output. You can publish assets and configure it through Laravel. It bootstraps some Collectors to work with Laravel and implements a couple custom DataCollectors, specific for Laravel. It is configured to display Redirects and (jQuery) Ajax Requests. (Shown in a dropdown) Read the documentation for more configuration options.

淡淡烟草味淡淡烟草味2733 days ago867

reply all(1)I'll reply

  • ringa_lee

    ringa_lee2017-05-16 16:58:03

    Record start/end time

    phpDebugbar::startMeasure('render','Time for rendering');
    Debugbar::stopMeasure('render');
    Debugbar::addMeasure('now', LARAVEL_START, microtime(true));
    Debugbar::measure('My long operation', function() {
        //Do something..
    });
    
    

    reply
    0
  • Cancelreply