Download the PHP package davidbehler/timer without Composer
On this page you can find all versions of the php package davidbehler/timer. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download davidbehler/timer
More information about davidbehler/timer
Files in davidbehler/timer
Package timer
Short Description A timer, in PHP. You can (re)start, pause and stop. And get the passed time. You can start/control multiple timers simultaneously by label.
License MIT
Homepage https://github.com/davidbehler/timer/
Informations about the package timer
timer
A timer, in PHP. You can (re)start, pause and stop. And get the passed time. With TimerCollection you can run multiple timers at once.
Currently supported time measuring options:
- Timer::DATETIME_TYPE: uses PHP's DateTime class (this is the default)
- Timer::MICROTIME_TYPE: uses PHP's microtime function
Installation
Using Composer
Without Composer
You can also download it from [Github] (https://github.com/davidbehler/timer), but no autoloader is provided so you'll need to register it with your own PSR-4 compatible autoloader.
Timer Usage
Create a new timer with autostart
Create a new timer with autostart and microtime option
Create a new timer without autostart
Manually start a timer
Pause a timer
Stop a timer
Unpause a paused timer
Restart a timer
Get duration of running timer in microseconds (uses current time)
Get duration of running timer in seconds with 4 digits after decimal point (uses current time)
Get duration of paused timer in seconds
Get duration of stopped timer in seconds
Get duration of timer paused/started multiple times in seconds
Get a report
TimerCollection Usage
Create a new TimerCollection with the microtime option. All timers within this collection will use the measuring option the collection was inititialized with.
Start a time and get it's duration in seconds
Start multiple timers at once and get their durations
You can also stop, pause and restart multiple timers at once
You can get a list of all timers
Get a single timer's report
Get a report for multiple timers