CloudCastle Clock

🇷🇺 Русский · 🇬🇧 English · 🇩🇪 Deutsch · 🇫🇷 Français · 🇪🇸 Español · 🇮🇹 Italiano

Comparison with competitors

All tables below are generated automatically from honest comparative tests (benchmarks/compare.php) running the SAME operation for every competitor, PHP 8.3.32, without Xdebug.

1. Features

Capability🏆 CloudCastlesymfonycarbonlcobuccibesteergebnisnew¹
PSR-20 ClockInterface (now(): DateTimeImmutable)✅✅✅✅✅✅❌
Frozen clock for deterministic tests✅✅✅✅✅✅❌
Mock clock with virtual sleep()✅✅❌❌❌❌❌
Monotonic clock (immune to system time jumps)✅✅❌❌❌❌❌
Time offset decorator (OffsetClock)✅❌❌❌❌❌❌
Time scale decorator (ScaledClock)✅❌❌❌❌❌❌
Truncation to an arbitrary unit✅❌❌❌❌❌❌
Duration value object with nanosecond precision✅❌✅❌❌❌❌
Deadlines with remaining time (Deadline)✅❌❌❌❌❌❌
Step and queue clocks for scenario tests✅❌❌❌❌❌❌
Stopwatch with laps included in the package✅❌❌❌❌❌❌
Cheap timestamp()/microtime() primitives without date objects✅❌❌❌❌❌❌
Application-clock-bound moment (DatePoint)✅✅✅❌❌❌❌
Scoped global clock substitution with auto-restore✅❌✅❌❌❌❌
Adapter for any PSR-20 clock✅✅❌❌✅❌❌
Calendar month/year arithmetic with overflow control (CalendarDate)✅❌✅❌❌❌❌
Localized diffForHumans and isoFormat without ext-intl✅❌❌❌❌❌❌
Calendar predicates and diffs (isWeekend, diffInDays, next)✅❌✅❌❌❌❌
PHPUnit trait for mocking time (mockTime/unmockTime)✅✅❌❌❌❌❌
Real sleep() on system and monotonic clocks✅✅❌❌❌❌❌
Wrapping any object with a now() method as PSR-20✅❌❌❌✅❌❌
Calendar period iteration with a step (CalendarPeriod)✅❌✅❌❌❌❌
Human-readable duration (TimeSpan::forHumans)✅❌✅❌❌❌❌
Macros: extending the date API without inheritance✅❌✅❌❌❌❌
Total🏆 248102420

2. Security and correctness

Property🏆 CloudCastlesymfonycarbonlcobuccibesteergebnisnew¹
Immutable readings (DateTimeImmutable)✅✅✅✅✅✅✅
Explicit timezone (independent of date.timezone)✅✅✅✅❌✅❌
Test determinism without mandatory global state✅✅❌✅✅✅❌
Monotonicity (resilient to system clock rollback)✅✅❌❌❌❌❌
Typed exceptions instead of false/warnings at the input boundary✅❌✅❌❌❌❌
Hostile input sanitising in exception messages✅❌❌❌❌❌❌
Integer overflow control for durations✅❌❌❌❌❌❌
Minimal dependencies (≤2, without ICU/ext-intl)✅❌❌✅✅✅✅
Total🏆 8434342

2.1. Compliance with Composer package security standards

StandardCloudCastlesymfonycarbonlcobuccibesteergebnis🏆 Winners
Security policy (SECURITY.md or a published process)✅✅✅❌✅✅CloudCastle, symfony, carbon, beste, ergebnis
Known-vulnerability control for dependencies (roave/security-advisories + composer audit)✅❌❌❌❌❌CloudCastle
OpenSSF Scorecard: published score ≥ 7/10❌✅❌❌❌❌symfony
CWE-20: input validation with typed exceptions✅❌✅❌❌❌CloudCastle, carbon
CWE-117/CWE-150: neutralising control characters in error messages✅❌❌❌❌❌CloudCastle
CWE-190: integer overflow control✅❌❌❌❌❌CloudCastle
Supply chain: ≤2 runtime dependencies without polyfills/ICU✅❌❌✅✅✅CloudCastle, lcobucci, beste, ergebnis
OpenSSF Best Practices: automated tests with mutation control in CI✅❌❌✅❌✅CloudCastle, lcobucci, ergebnis
OSI-approved licence in the distribution (MIT)✅✅✅✅✅✅CloudCastle, symfony, carbon, lcobucci, beste, ergebnis
Total🏆 833334CloudCastle

<sub>Sources: SECURITY.md files in the repositories (GitHub API), require-dev of the distributions on Packagist, api.securityscorecards.dev (symfony/clock — score of the symfony/symfony monorepo; OpenSSF Scorecard rates GitHub projects only, so CloudCastle on GitVerse has no score — an honest platform minus); CWE rows — from the packages’ security tests; symfony/clock for PHP 8.1 is the 6.4 branch with polyfill-php83.</sub>

3. Performance: now()

_Fetching the current moment now(), 200 000 times (min of 15)._

SolutionTime (ms)Verdict
new¹109,7baseline (not a library)
🏆 CloudCastle114,5fastest among libraries
🏆 ergebnis115,6on par with the leader (within measurement error)
🏆 lcobucci116on par with the leader (within measurement error)
🏆 beste116,8on par with the leader (within measurement error)
symfony154,6competitor
carbon649,8competitor

4. Performance: unix timestamp

_Current unix timestamp (whole seconds), 200 000 times._

SolutionTime (ms)Verdict
new¹16baseline (not a library)
🏆 CloudCastle27,8fastest among libraries
ergebnis122,3competitor
lcobucci123competitor
beste125,6competitor
symfony164,2competitor
carbon658,7competitor

5. Library memory consumption

_Library-only memory growth over 200 000 now() calls (isolated process, without autoloader weight)._

SolutionMemory (KB)Verdict
new¹1baseline (not a library)
🏆 beste3lightest among libraries
lcobucci5competitor
ergebnis5competitor
symfony30competitor
CloudCastle31competitor
carbon3 425competitor

6. Memory leaks

_Memory growth after warm-up over 200 000 now() calls (0 — no leaks)._

SolutionMemory (KB)Verdict
🏆 CloudCastle0leak-free
symfony0leak-free
carbon0leak-free
lcobucci0leak-free
beste0leak-free
ergebnis0leak-free
new¹0baseline (not a library)

7. Process memory peak

_Peak memory of an isolated process over 200 000 now() calls._

SolutionMemory (KB)Verdict
🏆 CloudCastle7 035lightest among libraries
🏆 symfony7 035on par with the leader (within measurement error)
🏆 lcobucci7 035on par with the leader (within measurement error)
🏆 beste7 035on par with the leader (within measurement error)
🏆 ergebnis7 035on par with the leader (within measurement error)
new¹7 035baseline (not a library)
carbon10 303competitor

8. Code quality

Tool🏆 CloudCastlesymfonycarbonlcobuccibesteergebnis
PHPStan✅ max + strict❌✅✅ + strict✅ + strict✅ + strict
Psalm✅ level 1✅ (monorepo)❌❌✅❌
PHPMD✅❌✅❌❌❌
PHPCS / CS-Fixer✅ PSR-12 + fixer✅ fixer✅✅❌✅ fixer
Rector✅❌❌❌❌✅
Deptrac (architecture layers)✅❌❌❌❌❌
Mutation testing (Infection)✅ MSI 100.0%❌❌✅❌✅
Line coverage (live)✅ 100.0%—————
Total🏆 823324

<sub>Competitor tooling is taken from the require-dev of their published distributions (snapshot July 2026); symfony/clock — from the symfony/symfony monorepo. CloudCastle metrics are live local-run results.</sub>

¹ The baseline (native calls without the completeness of a solution) is shown for context and does not compete with the libraries.

Results within 5% of the best are marked as equal: these solutions share a character-identical hot path (new DateTimeImmutable('now', $tz)), so at that scale the difference comes from machine noise, not code.


🇷🇺 Русский · 🇬🇧 English · 🇩🇪 Deutsch · 🇫🇷 Français · 🇪🇸 Español · 🇮🇹 Italiano