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 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

Technical Evaluation

Architecture fit. This is not a library that provides a domain capability; it's a shim that redefines a framework primitive. It swaps Illuminate\Support\Carbon so that Laravel's date/time facade resolves to Carbon\Carbon v2 semantics instead of the Carbon 1 semantics bundled with Laravel 5.5–5.7. Architecturally that means the package has no API surface of its own — it works by changing how a vendor class is loaded and resolved, which makes its blast radius the entire application (Eloquent date casting, model timestamps, validation rules, scheduler, Blade formatting, queue serialization) while its footprint in code review is close to zero. That asymmetry — invisible artifact, global effect — is the core architectural concern a TPM should flag, independent of code quality.

Integration feasibility. Feasible only inside the narrow matrix it was built for: Laravel 5.5–5.7 on PHP 7.1–7.3. It is a composer require plus an autoload/class-alias step, verifiable in a one-day spike. Outside that matrix it is not "feasible with effort," it is a fork. The value window has also closed: Laravel 5.8 allowed Carbon ^2.0 and Laravel 6+ requires it natively, so the package exists to paper over a gap that the framework resolved in early 2019 — five months after this package's last release.

Technical risk. High, on four axes:

  • Abandonment. Last release 2018-08-17; no commits or releases in six-plus years. It will not receive PHP 8 compatibility, Laravel 5.8+ compatibility, or fixes for Carbon 2 internals that changed across the ~70 minor releases since 2.0.
  • Signal quality. 63 stars and an aggregate score of 0.345 indicate very limited field validation. The author (kylekatarnls) is the Carbon maintainer, which is a positive signal about original intent and design, not about continued support.
  • Mechanism risk. Monkey-patching a framework vendor class depends on Composer autoload ordering and on Laravel's Illuminate\Support\Carbon subclass not gaining methods or return-type constraints. Both are unversioned assumptions.
  • Semantic drift. Carbon 2 altered date arithmetic, createFromFormat behavior, diff absoluteness, mutability/copy semantics, week-start handling, and DST edges. Any code path that silently relied on Carbon 1 quirks — including third-party packages — becomes a latent behavioral bug rather than a visible error.

Key questions.

  1. Which Laravel and PHP versions are actually in scope, and is a framework upgrade genuinely blocked?
  2. What specific transitive dependency requires nesbot/carbon: ^2.0? Can it be isolated behind an adapter instead of rewriting the framework class?
  3. Which packages in the lockfile type-hint Illuminate\Support\Carbon or assert Carbon 1 behavior in tests?
  4. Is the nesbot/carbon constraint loose enough that the shim would run against modern Carbon 2, and has anyone validated that pairing?
  5. Who owns the fork if this is adopted, and what is the removal ticket date?

Integration Approach

Stack fit. Fit is binary and narrow: Laravel 5.5–5.7. If the stack is Laravel 5.8+ or Laravel 6+, this package is redundant — native Carbon 2 support is already present and adopting the shim adds risk for zero benefit. If the stack is Laravel 5.8+ and someone is proposing this as a shortcut, that proposal should be rejected on the spot.

Migration path. Ranked by preference:

  1. Upgrade Laravel to a version with native Carbon 2 support. Highest effort, lowest residual risk, solves the problem permanently.
  2. Isolate the constraint. Keep Carbon 1 in the framework and contain the Carbon-2-demanding dependency behind a small internal adapter that translates between the two — ugly, but scoped and reversible.
  3. Adopt this shim as a time-boxed bridge, with a written expiry date and a tracked removal ticket. Acceptable only if option 1 is blocked by a hard external deadline and option 2 is demonstrably worse.
  4. Fork and vendor it. If adopted at all, expect to own the code; budget for it up front rather than after the first PHP upgrade.

Compatibility. Before any decision: run composer why nesbot/carbon and composer show --tree to find every consumer; inspect the package's require, replace, and autoload files directives to understand exactly how it hijacks resolution; confirm Composer's autoload ordering on the target PHP version; then build a test matrix covering date casting, validation (date, date_format, after/before), scheduling, timezone/DST cases, and JSON serialization of dates.

Sequencing. (a) Dependency inventory and constraint archaeology — 1–2 days. (b) Time-boxed spike in a throwaway branch with the full test suite, including a deliberate PHP-version bump — 2 days. (c) Decision gate against the Laravel upgrade estimate. (d) If adopted: full regression sweep, staged rollout, and an owner plus removal date recorded in the risk register before merge.

Operational Impact

Maintenance. Effectively zero upstream maintenance, so total maintenance burden transfers to the adopting team. The moment PHP 8 or Laravel 5.8 enters the roadmap, this becomes an internal fork. That cost is real and should be estimated at adoption time, not discovered later.

Support. No vendor, no active maintainer, negligible community. Internal engineers debugging a class-resolution problem in vendor code will find no issue tracker, no recent answers, and no one to escalate to. Documentation is a README from 2018.

Scaling. It has no effect on throughput or infrastructure cost. Its scaling cost is organizational: it converts every future framework or Carbon upgrade from a routine chore into a two-track compatibility analysis, and it makes the upgrade backlog harder to estimate because the shim's behavior is undocumented.

Failure modes. Concrete ones to watch: fatal class-redeclaration or autoload-order errors on a different PHP/Composer version; silent date-arithmetic drift; validation rules accepting or rejecting different inputs; timezone and DST off-by-one errors; different Eloquent date serialization in API responses; scheduler jobs firing at unexpected times; third-party packages breaking on Carbon 2 return types; and non-deterministic test failures that get muted instead of fixed.

Ramp-up. Installation is a half-day; understanding it is not. Any engineer touching date logic must know the shim exists — otherwise they will debug Carbon 2 behavior while reading Carbon 1 documentation, which is the most expensive failure mode here. Budget onboarding documentation and a code comment at every Carbon import site.

Verdict. Do not adopt for new work, and do not adopt as a shortcut on Laravel 5.8+. The only defensible use is a short-lived, explicitly owned bridge on Laravel 5.5–5.7 with an upgrade already funded. The correct default recommendation is to upgrade Laravel and remove the need entirely.

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.
mehedimi/laravel-amp-mail
happones/laravel-vue-i18n-generator
jwerd/inertia-table
siberfx/flysystem-wasabi
hollyit/token-replace
ippanelcom/laravel-sdk
adachsoft/changelog-linter
adachsoft/collection
payerurl/telegrambot-crypto-payment-instant-payout
dskripchenko/laravel-hybrid-search
riorizkyrainey/lara-ced
mehedimi/static-vel
zharp/zharp
nonsapiens/bigquery-model-sync
lgu-bayambang-ict-office/lgu-laravel-development-standards
andydefer/laravel-support
se7enxweb/flysystem
lampwick/laravel
jeslage/statamic-emojis
micahdshackelford/rmap-laravel