fyre / timer
A timer library.
v4.0.2
2024-10-30 11:21 UTC
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.59
- fyre/php-cs-fixer-config: ^1.0
- phpunit/phpunit: ^11
README
FyreTimer is a free, open-source timer library for PHP.
Table Of Contents
Installation
Using Composer
composer require fyre/timer
In PHP:
use Fyre\Utility\Timer;
Basic Usage
$timer = new Timer();
Methods
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.
$name
is a string representing the timer name.
$elapsed = $timer->elapsed($name);
Get
Get a timer.
$name
is a string representing the timer name.
$data = $timer->get($name);
Has
Check if a timer exists.
$name
is a string representing the timer name.
$hasTimer = $timer->has($name);
Is Stopped
Determine whether a timer is stopped.
$name
is a string representing the timer name.
$isStopped = $timer->isStopped($name);
Remove
Remove a timer.
$name
is a string representing the timer name.
$timer->remove($name);
Start
Start a timer.
$name
is a string representing the timer name.
$timer->start($name);
Stop
Stop a timer.
$name
is a string representing the timer name.
$timer->stop($name);
Stop All
Stop all timers.
$timer->stopAll();