kanel / timer
A simple PHP timer that allows to benchamrk the code
Installs: 122
Dependents: 2
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
pkg:composer/kanel/timer
Requires
- php: >=7.0
Requires (Dev)
- phpunit/phpunit: 6.0.8
This package is not auto-updated.
Last update: 2025-10-12 06:32:39 UTC
README
A simple Timer to benchmark functions or code execution duration
#How it works :
-
Start the timer
Timer::start();
-
Mark a place as a lap (the timer will continue counting time after returning the difference between the start and this lap)
$duration = Timer::lap();
where $duration is in milliseconds
-
If you want the duration between this lap and the last one, send this constant as a parameter:
$duration = Timer::lap(Timer::FROM_LAST_LAP);
-
To stop the time and get the duration from the beginning (the start)
$duration = Timer::stop();
-
To stop the time and get the duration from the last lap
$duration = Timer::stop(Timer::FROM_LAST_LAP);