Weave 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
Laravel Carbon 2

Laravel Carbon 2 Laravel Package

kylekatarnls/laravel-carbon-2

Integrates Carbon 2 into Laravel apps that still ship Carbon 1. Swap the bundled Carbon for the newer API—localization, diff methods, immutable dates—without upgrading your framework. A drop-in compatibility bridge for older Laravel versions.

View on GitHub
Deep Wiki
Context7

Carbon 2 adapter for Laravel

Frequently asked questions about Laravel Carbon 2
What is kylekatarnls/laravel-carbon-2 used for?
It is a Carbon 2 adapter for Laravel apps that still bundle Carbon 1. It swaps Illuminate\Support\Carbon so Laravel's date handling resolves to Carbon\Carbon v2 semantics, giving you newer date APIs like localization and immutable dates without upgrading the framework. It is intended only for Laravel 5.5 through 5.7.
Which Laravel versions does laravel-carbon-2 support?
It targets Laravel 5.5, 5.6, and 5.7 only. Laravel 5.8 allowed nesbot/carbon ^2.0 natively, and Laravel 6+ requires Carbon 2, so the package is redundant on those versions. Do not install it on Laravel 5.8 or newer.
What PHP versions can I use with this Carbon 2 adapter?
The supported matrix is PHP 7.1 through 7.3, matching the Laravel 5.5-5.7 era. The package has had no releases since August 2018, so it does not include PHP 8 compatibility work. Running it on newer PHP versions is unsupported and untested.
How do I install laravel-carbon-2?
Install it with Composer using composer require kylekatarnls/laravel-carbon-2. The package works through Composer autoloading and class aliasing rather than a service provider API of its own, so the main setup is ensuring the shim loads before Laravel resolves Illuminate\Support\Carbon. Validate the wiring in a short spike before rolling it out.
Is laravel-carbon-2 still maintained?
No. The last release was on 2018-08-17, with no commits or releases in more than six years. The author is the Carbon maintainer, which speaks to original design intent but not ongoing support. Treat any adoption as owning a fork rather than consuming a maintained dependency.
Is it safe to use laravel-carbon-2 in production?
It carries high risk because it monkey-patches a framework vendor class and has a global blast radius across Eloquent casting, timestamps, validation, scheduling, Blade formatting, and queue serialization. It also depends on unversioned assumptions about Composer autoload order and Laravel's Carbon subclass. Use it only as a time-boxed bridge with a written removal ticket, or avoid it entirely.
What Carbon 2 behavior changes should I watch for after installing it?
Carbon 2 changed date arithmetic, createFromFormat behavior, diff absoluteness, mutability and copy semantics, week-start handling, and DST edge cases. Code that silently relied on Carbon 1 quirks, including third-party packages, can become a latent behavioral bug instead of a visible error. Audit any package that type-hints Illuminate\Support\Carbon or asserts Carbon 1 behavior in tests.
What are the alternatives to laravel-carbon-2?
The best option is upgrading Laravel to a version with native Carbon 2 support. If a dependency demands nesbot/carbon ^2.0 and a framework upgrade is blocked, isolate that dependency behind an internal adapter that translates between Carbon 1 and Carbon 2. Adopting this shim should be the last resort, and forking and vendoring it means budgeting to maintain it yourself.
Does laravel-carbon-2 work with Laravel 5.8 or Laravel 6?
No, and you should not use it there. Laravel 5.8 permits Carbon ^2.0 and Laravel 6+ requires Carbon 2 natively, so the shim adds risk for zero benefit. If someone proposes it on Laravel 5.8+, reject the proposal and use the framework's built-in Carbon 2 support.
What should I check before adopting laravel-carbon-2?
Confirm your app is actually on Laravel 5.5-5.7 and PHP 7.1-7.3, and that a framework upgrade is genuinely blocked. Identify which transitive dependency requires nesbot/carbon ^2.0 and whether it can be isolated instead. Check your lockfile for packages that type-hint Illuminate\Support\Carbon or assert Carbon 1 behavior, and assign an owner plus a removal date if you proceed.
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.
socialdept/atp-orm
cboxdk/laravel-assistant-client
socialdept/atp-resolver
socialdept/tenant-domains
tautvydasr/blade-class-names
socialdept/color-scales
maherelgamil/controller
coleus/widgets
coleus/table
coleus/users
coleus/music
coleus/health
coleus/calendar
coleus/notes
coleus/support
coleus/settings
coleus/apps
seampact/laravel
emmyconceptng/laravel-ng-postcode
jjsquady/round-robin