Answers for "calculate total time in laravel"

PHP
0

counting time execution duration in time laravel

# 1. get initial time
$start = now();

  // code here ...

# 2. get diff time from $start
$time = $start->diffInSeconds(now());

# 3. convert it in human readable
$_format = CarbonCarbonInterval::seconds($time)->cascade()->forHumans();
Posted by: Guest on September-26-2021
0

how check the time of operation in laravel

$timeStart = microtime(true);

App::finish(function() use ($timeStart) {
    $diff = microtime(true) - $timeStart;
    $sec = intval($diff);
    $micro = $diff - $sec;
    Log::debug(Request::getMethod() . "[" . Request::url() . "] Time: " . round($micro * 1000, 4) . " ms");
});
Posted by: Guest on August-02-2021

Code answers related to "calculate total time in laravel"

Browse Popular Code Answers by Language