(PHP) Log Laravel execution time to console

By | July 4, 2015

Put this in app/start/global.php to get Laravels execution time to the browser console log.

L4

$start = microtime(true);

App::finish(function() use ($start) {
    echo "<script>console.log('App finish: ".round((microtime(true) - $start) * 1000, 3)." ms')</script>";
});

This works with L5:

This page took {{ (microtime(true) - LARAVEL_START) }} seconds to render

Leave a Reply

Your email address will not be published. Required fields are marked *