jbevanac/time-interface

Simple utility library for converting between hours, minutes, and seconds.

Maintainers

Package info

github.com/jbevanac/time-interface

pkg:composer/jbevanac/time-interface

Statistics

Installs: 690

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v0.1.6 2026-02-20 09:48 UTC

This package is auto-updated.

Last update: 2026-02-20 09:49:14 UTC


README

A lightweight PHP library for precise and consistent conversion between hours, minutes, and seconds.

This package provides a simple and strict TimeInterface along with concrete implementations for Hours, Minutes, and Seconds, making time-based calculations predictable, readable, and safe.

📦 Installation

composer require jbevanac/time-interface

Basic Usage

Creating Time Objects

use Jbevanac\TimeInterface\Hours;
use Jbevanac\TimeInterface\Minutes;
use Jbevanac\TimeInterface\Seconds;

$hours   = Hours::create(1.5);
$minutes = Minutes::createFromHours(1.5);
$seconds = Seconds::createFromMinutes(90);

Converting between Units

$time = Hours::create(1.5);

$time->getHours();   // 1.50
$time->getMinutes(); // 90.0
$time->getSeconds(); // 5400.0

📄 License

MIT © Jonathan Bevan