beste/clock
A collection of PSR-20 clock implementations for PHP, including SystemClock, LocalizedClock, UTCClock, FrozenClock for tests, MinuteClock, and WrappingClock. Freeze time, set time zones, or wrap any object with a now() method. Install via composer require beste/clock.
beste/clock is a collection of ready-to-use PSR-20 Clock implementations for PHP, giving you a clean and testable way to obtain the current time. Rather than calling new DateTimeImmutable() directly, you inject a clock and keep your code deterministic.
SystemClock – the current time, using your environment's configured time zoneLocalizedClock – the current time in an explicit time zoneUTCClock – the current time, always in UTCFrozenClock – a stopped clock, perfect for testsMinuteClock / WrappingClock – reduced precision, or wrap any object with a now() methodcomposer require beste/clock
How can I help you explore Laravel packages today?