PSR-20 Clock Generator

•
45
•

Generates standards-compliant PSR-20 Clock implementations and unit tests for robust PHP 8.4 time management.

The PSR-20 Clock Generator is a specialized skill for Claude Code designed to automate the creation of a comprehensive time abstraction layer within PHP applications. By generating PSR-20 compliant interfaces and implementations—including SystemClock, FrozenClock, OffsetClock, and MonotonicClock—this tool helps developers decouple business logic from the system clock. This is essential for building testable, high-quality software where time-sensitive operations like subscription expirations, scheduling, and logging need to be verified with deterministic results. The skill follows modern PHP 8.4 standards, utilizing readonly classes and strict typing for maximum reliability.

Key Features

01Generates PSR-20 compliant ClockInterface and production-ready implementations.
02Implements MonotonicClock to prevent issues with system clock drifts.
03Creates comprehensive PHPUnit test suites for all generated clock components.
04Provides FrozenClock for deterministic mocking in unit and integration tests.
05Includes OffsetClock for simulating specific time intervals (ahead/behind).
0645 GitHub stars

Use Cases

01Standardizing time management across distributed PHP microservices.
02Implementing Clean Architecture or DDD by injecting time as a dependency.
03Testing time-dependent business logic such as trial periods or token expirations.