tempest/clock
A lightweight clock abstraction for the Tempest framework, offering a testable interface for reading the current time. Swap in a frozen or mock clock during tests so time-dependent code stays deterministic instead of relying on native PHP date functions.
now() inside domain code. That single decision unlocks deterministic tests for anything the roadmap touches that has a temporal edge: subscription trials, proration and billing cutoffs, coupon windows, token and session expiry, SLA timers, rate-limit windows, "as of" reporting, and aging/collections views.setTestNow vs. a PSR-20 clock binding, not this dependency vs. building a time service from scratch.Consider it only when all of the following hold:
Look elsewhere (or just implement the pattern directly) when:
Illuminate\Support\Carbon::setTestNow() / Carbon::setTestNow() already gives deterministic time in tests, is battle-tested, and adds no new dependency. Pair it with a container-bound Clock interface if you want the seam.psr/clock plus symfony/clock offers a widely adopted interface, a MockClock for tests, and long-term backing. That is the low-risk default for a Laravel/Symfony shop.sleep, or scheduler integration are all out of scope here.To executives (one paragraph): We evaluated tempest/clock, a small MIT-licensed time utility from the Tempest PHP ecosystem. The package itself is not the takeaway — it is a thin wrapper with no adoption (zero stars, zero dependents) and no maintenance track record, so it is not something we should put on our dependency graph today. What it validates is a cheap, high-leverage engineering pattern: stop reading the system clock inside business logic and inject time instead. That pattern makes time-sensitive features — trials, billing cutoffs, expirations, SLAs, reporting — deterministic to test and safer to ship, and we can get it from libraries we already depend on (Carbon / PSR-20 clock) at roughly a day of engineering effort and no new vendor risk. Recommendation: adopt the pattern, decline the dependency.
To engineering (short form): Treat this as a reference implementation, not a dependency. If we want the seam, bind a Clock interface in the container backed by psr/clock + symfony/clock, and use Carbon::setTestNow()/MockClock in tests. Migration is mechanical: replace inline now() calls in domain and service code with the injected clock, start with the highest-risk paths (billing proration, trial expiry, token TTL), and leave framework internals alone. If we were ever on Tempest, this package would be a reasonable starting point — but even then, budget for forking it and owning it, because nobody else is.
How can I help you explore Laravel packages today?