(PHP) Log Laravel execution time to console


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

L4
[php]
$start = microtime(true);

App::finish(function() use ($start) {
echo "<script>console.log(‘App finish: ".round((microtime(true) – $start) * 1000, 3)." ms’)</script>";
});
[/php]

This works with L5:
[html]
This page took {{ (microtime(true) – LARAVEL_START) }} seconds to render
[/html]

Leave a Reply

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