fyre/timer

A timer library.

v4.0.2 2024-10-30 11:21 UTC

This package is auto-updated.

Last update: 2024-10-30 11:22:08 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;

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();