PSR-20 system clock for Marko--inject ClockInterface instead of calling time() so time-dependent code can be tested deterministically.
composer require marko/clockuse Psr\Clock\ClockInterface;
class TokenIssuer
{
public function __construct(
private ClockInterface $clock,
) {}
public function expiresAt(): DateTimeImmutable
{
return $this->clock->now()->modify('+1 hour');
}
}Full usage, API reference, and examples: marko/clock