Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Clock Laravel Package

lcobucci/clock

PSR-20 clock implementation for PHP. Provides a simple, testable way to access the current time with interchangeable clocks like system and frozen clocks, making time-dependent code predictable and easy to unit test.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Enables consistent time handling across codebase via interface-based abstraction, reducing reliance on global time functions like new DateTimeImmutable().
  • Critical for features involving scheduling, expirations, or time-sensitive workflows where test determinism is essential (e.g., subscription management, event triggers, analytics).
  • Supports "build vs buy" decision by providing a proven, lightweight solution instead of custom implementation, saving engineering effort and reducing technical debt.
  • Aligns with clean architecture principles by decoupling domain logic from infrastructure concerns, improving long-term maintainability and testability.

When to Consider This Package

  • Adopt when your application has time-dependent business logic requiring precise testing (e.g., subscription expirations, event scheduling, rate limiting).
  • Use when flaky tests due to real-time dependencies are impacting CI/CD reliability or developer productivity.
  • Avoid if your project has no time-based logic, or if you're using a framework with native clock abstraction (though Laravel does not provide this out-of-the-box).
  • Not suitable for projects where dependency injection is strictly avoided, though the package’s minimal footprint makes adoption low-risk even in existing codebases.

How to Pitch It (Stakeholders)

  • Executives: "This library eliminates time-related bugs and flaky tests, reducing maintenance costs and improving product reliability. By standardizing time handling, we prevent costly failures in scheduling or expiration logic, directly improving customer trust and product stability with minimal investment."
  • Engineering: "Replace fragile DateTime calls with a testable interface—inject SystemClock in production and FixedClock in tests for 100% deterministic test runs. It’s framework-agnostic, integrates seamlessly with Laravel’s DI container, and adds zero runtime overhead while cutting test debugging time by 30–50%."
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
enqueue/dsn
bunny/bunny
enqueue/test
enqueue/null
enqueue/amqp-tools
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport
twbs/bootstrap4