fyre/timer

A timer library.

v3.0.10 2024-06-29 01:43 UTC

This package is auto-updated.

Last update: 2024-08-29 01:59:45 UTC


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;

Methods

All

Get all timers.

$timers = Timer::all();

Clear

Clear all timers.

Timer::clear();

Count

Get the number of timers.

$timerCount = 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.
$timer = 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.
$removed = 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();