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

eventsauce/clock

Simple clock abstraction for PHP. Use SystemClock in production and TestClock in tests to control time deterministically. Get now() as DateTimeImmutable, access timeZone(), move time forward, tick to system time, or fixate to a specific moment.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Event-Driven Architecture (EDA) Alignment: Enables precise control over time handling in event-sourced systems, ensuring deterministic replay of events and accurate time-based logic (e.g., deadlines, scheduling).
  • Testing & Debugging: Facilitates time manipulation (e.g., freezing, advancing) for unit/integration tests, reducing flakiness in time-sensitive workflows (e.g., subscriptions, notifications).
  • Build vs. Buy: Avoids reinventing time-handling utilities (e.g., custom mock clocks) while maintaining flexibility for domain-specific time logic.
  • Roadmap for Observability: Supports time-aware event tracing (e.g., latency analysis) by decoupling real time from application logic.
  • Use Cases:
    • Financial systems (e.g., time-bound transactions).
    • Scheduling platforms (e.g., job queues, calendar events).
    • Compliance-heavy domains (e.g., audit logs with timestamp validation).

When to Consider This Package

  • Adopt if:
    • Your system relies on event sourcing or CQRS and needs deterministic time handling.
    • You require reproducible tests for time-sensitive logic (e.g., "expire after 30 days").
    • Your team lacks a standardized way to mock/control time in PHP tests.
    • You’re building a time-aware microservice (e.g., real-time notifications, leasing systems).
  • Look Elsewhere if:
    • Your app uses simple cron jobs or basic timestamps (e.g., Carbon or DateTime suffice).
    • You’re not using PHP/Laravel (package is PHP-specific).
    • Your time logic is trivial (e.g., no need for test-time manipulation).
    • You require high-precision time (e.g., nanoseconds) beyond what this package offers.

How to Pitch It (Stakeholders)

For Executives: "This lightweight package lets us treat time as a pluggable dependency—critical for our event-driven architecture. It’s like a ‘time freeze’ button for tests, ensuring our scheduling and compliance features work flawlessly in staging and production. Minimal overhead, but massive payoff for reliability and developer velocity."

For Engineering: *"Clock decouples real time from business logic, making our event-sourced workflows testable and deterministic. Swap the real SystemClock with a MockClock in tests—no more flaky time-based failures. Works seamlessly with Laravel’s service container. Let’s use it for:

  • Tests: Freeze time to verify ‘expire in 24h’ logic.
  • Production: Inject a UTCClock for consistency across regions.
  • Future: Extend for time-zone-aware events if needed. No reinventing the wheel; just 100% focus on our domain logic."*
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.
emuniq/filament-browser-notifications
syriable/filament-translator
hungnm28/livewire-form
wenprise/eloquent
crudly/encrypted
fadion/bouncy
cuci/prototurk-sdk
gos/pubsub-router-bundle
cuci/prototurk-sdk-symfony
clementtalleu/easyadmin-markdown-bundle
codeflextech/permission-manager
karnoweb/livewire-datepicker
sayedenam/sayed-dashboard
milito/query-filter
apiboxsym/user-bundle
apiboxsym/health-check-bundle
jayeshmepani/jpl-moshier-ephemeris-php
elnasnato/laraliveui
labrodev/rest-sdk
sampaui/sampaui