Back to Blog
#basketin#cart#laravel#release#v2

Basketin Cart V2: Lighter Core, Smarter Totals

Author Obelaw Team
Published
Basketin Cart V2: Lighter Core, Smarter Totals

Basketin Cart V2 is a major evolution of the package, focused on making cart logic more flexible while reducing framework coupling.

The work is tracked in this pull request: https://github.com/basketin/cart/pull/1

Why V2?

V2 simplifies the package into a cleaner, more focused core:

  • A modernized baseline for current Laravel and PHP versions
  • Less framework-specific surface area
  • A more expressive totals API for real-world pricing scenarios
  • Better maintainability for long-term package growth

What Is New in V2

Flexible Totals API

One of the biggest improvements is a totals system built around additions and discounts, replacing rigid coupon-only flows.

This gives you clearer control over how totals are composed, including keyed adjustments for tracking and recalculation.

Cart Core Improvements

V2 introduces internal cart abstractions and management interfaces that make totals and configuration handling more consistent.

This enables cleaner extension points for package users and fewer edge-case paths in cart lifecycle management.

Leaner Package Scope

Several optional or tightly coupled areas were removed from the core package so Basketin Cart can stay focused on cart-domain concerns.

The result is a lighter dependency footprint and a simpler developer experience.

Promotions Engine (New)

V2 now pairs with a dedicated promotions package:

This separates advanced promotion logic from the cart core while still integrating with totals, giving teams a cleaner way to implement campaign rules, conditional offers, and extensible pricing behavior.

Breaking Changes You Should Plan For

V2 includes intentional breaking changes. Key updates from the PR include:

  • PHP requirement updated to 8.3+
  • Laravel requirement updated to 11+
  • Filament-related classes removed from the package
  • Coupon system removed in favor of additions and discounts
  • Order-related model/trait and related migration paths removed
  • Cart initialization API updated to a unified creation flow

If your application relies on any of the removed features, prepare a migration path before upgrading.

Suggested Migration Checklist

Use this checklist when moving from V1 to V2:

  1. Upgrade runtime to supported PHP and Laravel versions.
  2. Replace coupon-centric logic with addition/discount total adjustments.
  3. Refactor cart bootstrapping to the new cart creation API.
  4. Remove dependencies on in-package Filament resources.
  5. Audit order and field-related integrations if you used package-provided models.
  6. Add basketin/cart-promotions if you need promotion workflows beyond base additions/discounts.
  7. Re-run and expand tests around totals, checkout math, promotion rules, and cart state transitions.

Release Notes and Source

For commit-level changes and ongoing discussion, see:

We will continue publishing upgrade examples and implementation patterns as V2 adoption expands.

Thanks for reading!