🇷🇺 Русский · 🇬🇧 English · 🇩🇪 Deutsch · 🇫🇷 Français · 🇪🇸 Español · 🇮🇹 Italiano
CloudCastle Clock
PSR-20 clocks for PHP 8.1+ with deterministic time in tests: 11 clock implementations, nanosecond-precision TimeSpan, Stopwatch, Deadline, DatePoint and CalendarDate. Lightweight dependencies: psr/clock and cloud-castle/inflector.
composer require cloud-castle/clock
Sections
| Page | Contents |
|---|---|
| Quick start | first steps in five minutes |
| Installation | requirements and setup |
| Examples | typical production and test scenarios |
| Architecture | layers, contracts, package diagram |
| Comparison | auto-generated tables with winners |
| Testing | the quality pipeline and live thresholds |
| Lifecycle | project mermaid diagrams |
| FAQ | frequent questions |
Features
| Feature | In short |
|---|---|
| SystemClock | system clock |
| FrozenClock | frozen clock |
| MockClock | mock clock with virtual sleep |
| MonotonicClock | monotonic clock |
| OffsetClock | offset clock |
| ScaledClock | scaled clock |
| TruncatingClock | truncating clock |
| StepClock | step clock |
| QueueClock | queue clock |
| CallbackClock | callback clock |
| PsrClockAdapter | PSR-20 clock adapter |
| TimeSpan | nanosecond-precision duration |
| Deadline | deadlines |
| Stopwatch | stopwatch |
| DatePoint | application-clock moment |
| ClockHolder | global clock with scoped substitution |
| Clock | static facade |
| ClockAwareTrait | setter clock injection |
| CalendarDate | Carbon-grade calendar arithmetic |
| CalendarPeriod | calendar period iteration |
| ClockSensitiveTrait | mocking time in PHPUnit |
| CalendarDate macros | extending the API without inheritance |
🇷🇺 Русский · 🇬🇧 English · 🇩🇪 Deutsch · 🇫🇷 Français · 🇪🇸 Español · 🇮🇹 Italiano