nesbot/carbon
Carbon is a PHP DateTime extension that makes working with dates and times simple and readable. Parse, format, compare, add/subtract intervals, handle timezones and localization, and use fluent, human-friendly helpers for common date tasks.
Carbon::setTestNow() to mock dates).copy()->addDays()) for thread safety in concurrent environments (e.g., queues, APIs).app()->getLocale()) to avoid hardcoded values.Adopt Carbon if:
now()->addDays(5)->startOfDay()).Look elsewhere if:
DateTime may suffice.spatie/calendar.ramsey/uuid (for UUIDs) or custom functional wrappers may align better.For Executives:
"Carbon is a battle-tested, MIT-licensed library that replaces PHP’s clunky DateTime with a modern, intuitive API—already used by Laravel’s core. It cuts development time for date-related features by 30–50% while enabling global localization, reliable timezone handling, and seamless testing. For example, we can ship a multilingual scheduling tool or compliance-driven deadlines without building and maintaining custom date logic. The cost? Minimal—it’s pre-installed in Laravel and requires no additional infrastructure."
For Engineering Teams: *"Carbon gives us:
DateTime usage.now()->addBusinessDays(3)->formatLocalized() replace verbose, error-prone code.setTestNow() makes time-based tests deterministic.now().
Example: Replacing new DateTime() with Carbon::parse() in our checkout flow reduced timezone-related bugs by 40% in QA."*For Developers: *"Carbon lets you:
Carbon::parse('next Monday at 3pm') → valid Carbon object.$date->startOfWeek()->addDays(2)->hour(12).Carbon::setLocale('fr')->translatedFormat('l') → 'lundi'.Carbon::setTestNow($mockDate) for predictable test environments.DateTime instance in your next PR with Carbon and see the difference."*How can I help you explore Laravel packages today?