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.
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:
Illuminate\Support\Carbon subclass not gaining methods or return-type constraints. Both are unversioned assumptions.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.
nesbot/carbon: ^2.0? Can it be isolated behind an adapter instead of rewriting the framework class?Illuminate\Support\Carbon or assert Carbon 1 behavior in tests?nesbot/carbon constraint loose enough that the shim would run against modern Carbon 2, and has anyone validated that pairing?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:
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.
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.
How can I help you explore Laravel packages today?