brick/date-time
Immutable, ISO-8601–focused date/time API for PHP 8.2+ built on top of native DateTime, adding missing types like LocalDate, LocalTime, YearMonth, and MonthDay. Inspired by Java’s JSR-310, well-tested, production-ready, Composer installable.
ZonedDateTime, TimeZoneRegion) for global applications (e.g., SaaS platforms, logistics, or multi-region event coordination).Clock system (e.g., FixedClock, travelTo()) simplifies time-based testing, reducing flakiness in CI/CD pipelines for features like:
Carbon/DateTime logic, reducing tech debt and improving maintainability.DateTime logic in core services (e.g., user account expiration, event scheduling).brick/date-time-doctrine).Carbon or DateTime for your use cases (e.g., simple date formatting).spatie/array-to-object or league/iso8601 for lightweight needs.TIMESTAMPTZ); use ORM-specific tools.LocalDateRange for date-based intervals (e.g., "Q1 2025").Duration/Period for precise time arithmetic (e.g., "3 years, 2 months").Stopwatch for benchmarking or performance tracking."This package modernizes our date/time handling with a battle-tested, ISO-compliant library that reduces bugs in time-sensitive features. For example:
FixedClock)."This replaces inconsistent DateTime/Carbon usage with a type-safe, immutable API that:
LocalDate::now() won’t mutate state).travelTo() and freeze() make time-based tests deterministic (no more sleep(1) hacks).DayOfWeek::MONDAY), strict typing, and PHP 8.2+ features.brick/date-time-doctrine) and has zero dependents (no hidden risks).
Migration effort: ~2–4 weeks for core services, with incremental adoption via feature flags."*"Key wins:
strtotime hacks: Parse ISO 8601 strings directly (e.g., LocalDate::parse('2025-03-15')).nextDayOfWeek() or getQuarter() replace verbose DateTime arithmetic.DefaultClock::freeze()—no more DateTime::modify() spaghetti.
Example swap:// Before (Carbon)
$nextWeek = Carbon::now()->addWeek()->startOfDay();
// After (Brick)
$nextWeek = LocalDate::now()->nextOrSameDayOfWeek(DayOfWeek::MONDAY);
```"
How can I help you explore Laravel packages today?