FyreTimer is a free, open-source timer library for PHP.
Using Composer
composer require fyre/timer
In PHP:
use Fyre\Utility\Timer;$timer = new Timer();All
Get all timers.
$timers = $timer->all();Clear
Clear all timers.
$timer->clear();Count
Get the number of timers.
$count = $timer->count();Elapsed
Get the elapsed time for a timer.
$nameis a string representing the timer name.
$elapsed = $timer->elapsed($name);Get
Get a timer.
$nameis a string representing the timer name.
$data = $timer->get($name);Has
Check if a timer exists.
$nameis a string representing the timer name.
$hasTimer = $timer->has($name);Is Stopped
Determine whether a timer is stopped.
$nameis a string representing the timer name.
$isStopped = $timer->isStopped($name);Remove
Remove a timer.
$nameis a string representing the timer name.
$timer->remove($name);Start
Start a timer.
$nameis a string representing the timer name.
$timer->start($name);Stop
Stop a timer.
$nameis a string representing the timer name.
$timer->stop($name);Stop All
Stop all timers.
$timer->stopAll();