Search by

marko / clock

markshust

PSR-20 system clock for Marko Framework

Package info

github.com/marko-php/marko-clock

Type:marko-module

pkg:composer/marko/clock

Statistics

Installs: 283

Dependents: 27

Suggesters: 0

Stars: 0

0.11.0 2026-10-05 23:03 UTC

This package is auto-updated.

Last update: 2026-10-09 21:31:01 UTC


README

PSR-20 system clock for Marko--inject ClockInterface instead of calling time() so time-dependent code can be tested deterministically.

Installation

composer require marko/clock

Quick Example

use Psr\Clock\ClockInterface;

class TokenIssuer
{
    public function __construct(
        private ClockInterface $clock,
    ) {}

    public function expiresAt(): DateTimeImmutable
    {
        return $this->clock->now()->modify('+1 hour');
    }
}

Documentation

Full usage, API reference, and examples: marko/clock