🇷🇺 Русский · 🇬🇧 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 | 🏆 CloudCastle | symfony | carbon | lcobucci | beste | ergebnis | new¹ |
|---|---|---|---|---|---|---|---|
| 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 | 🏆 24 | 8 | 10 | 2 | 4 | 2 | 0 |
2. Security and correctness
| Property | 🏆 CloudCastle | symfony | carbon | lcobucci | beste | ergebnis | new¹ |
|---|---|---|---|---|---|---|---|
| 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 | 🏆 8 | 4 | 3 | 4 | 3 | 4 | 2 |
2.1. Compliance with Composer package security standards
| Standard | CloudCastle | symfony | carbon | lcobucci | beste | ergebnis | 🏆 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 | 🏆 8 | 3 | 3 | 3 | 3 | 4 | CloudCastle |
<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)._
| Solution | Time (ms) | Verdict |
|---|---|---|
| new¹ | 109,7 | baseline (not a library) |
| 🏆 CloudCastle | 114,5 | fastest among libraries |
| 🏆 ergebnis | 115,6 | on par with the leader (within measurement error) |
| 🏆 lcobucci | 116 | on par with the leader (within measurement error) |
| 🏆 beste | 116,8 | on par with the leader (within measurement error) |
| symfony | 154,6 | competitor |
| carbon | 649,8 | competitor |
4. Performance: unix timestamp
_Current unix timestamp (whole seconds), 200 000 times._
| Solution | Time (ms) | Verdict |
|---|---|---|
| new¹ | 16 | baseline (not a library) |
| 🏆 CloudCastle | 27,8 | fastest among libraries |
| ergebnis | 122,3 | competitor |
| lcobucci | 123 | competitor |
| beste | 125,6 | competitor |
| symfony | 164,2 | competitor |
| carbon | 658,7 | competitor |
5. Library memory consumption
_Library-only memory growth over 200 000 now() calls (isolated process, without autoloader weight)._
| Solution | Memory (KB) | Verdict |
|---|---|---|
| new¹ | 1 | baseline (not a library) |
| 🏆 beste | 3 | lightest among libraries |
| lcobucci | 5 | competitor |
| ergebnis | 5 | competitor |
| symfony | 30 | competitor |
| CloudCastle | 31 | competitor |
| carbon | 3 425 | competitor |
6. Memory leaks
_Memory growth after warm-up over 200 000 now() calls (0 — no leaks)._
| Solution | Memory (KB) | Verdict |
|---|---|---|
| 🏆 CloudCastle | 0 | leak-free |
| symfony | 0 | leak-free |
| carbon | 0 | leak-free |
| lcobucci | 0 | leak-free |
| beste | 0 | leak-free |
| ergebnis | 0 | leak-free |
| new¹ | 0 | baseline (not a library) |
7. Process memory peak
_Peak memory of an isolated process over 200 000 now() calls._
| Solution | Memory (KB) | Verdict |
|---|---|---|
| 🏆 CloudCastle | 7 035 | lightest among libraries |
| 🏆 symfony | 7 035 | on par with the leader (within measurement error) |
| 🏆 lcobucci | 7 035 | on par with the leader (within measurement error) |
| 🏆 beste | 7 035 | on par with the leader (within measurement error) |
| 🏆 ergebnis | 7 035 | on par with the leader (within measurement error) |
| new¹ | 7 035 | baseline (not a library) |
| carbon | 10 303 | competitor |
8. Code quality
| Tool | 🏆 CloudCastle | symfony | carbon | lcobucci | beste | ergebnis |
|---|---|---|---|---|---|---|
| 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 | 🏆 8 | 2 | 3 | 3 | 2 | 4 |
<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