Skip to content

v3.0.0

Latest

Choose a tag to compare

@joelwmale joelwmale released this 13 Jun 05:58
d1169f5

Summary

Version 3.0.0 is a major release that introduces a pluggable storage driver system, first-class coupon/tax/shipping objects, a full testing harness, Livewire and Inertia integrations, Artisan generators, and PHPStan static analysis at level 5 with zero errors. Existing code continues to work unchanged - the new features are additive.

Added

  • Storage driver system - CartDriver interface and CartManager with built-in SessionDriver, DatabaseDriver, RedisDriver, NullDriver, and MultiDriver implementations - @joelwmale
  • Cart::fake() - swaps the active driver for an in-memory NullDriver and returns a CartFactory for fluent test state seeding - @joelwmale
  • CartFactory - fluent builder for seeding cart state in tests via withItems(), withCondition(), and withCoupon() - @joelwmale
  • Cart assertion methods - assertContains(), assertCount(), assertTotalQuantity(), assertSubTotal(), assertTotal(), assertConditionApplied(), assertEmpty(), assertNotEmpty() - @joelwmale
  • Coupon abstract class - extend to create first-class coupon objects that convert to CartCondition - @joelwmale
  • TaxRule abstract class - extend to create first-class tax rules that convert to CartCondition - @joelwmale
  • ShippingRate abstract class - extend to create first-class shipping rates that convert to CartCondition - @joelwmale
  • Cart::coupon(), Cart::tax(), Cart::shipping() - accept first-class objects or raw CartCondition instances - @joelwmale
  • HasCart trait - Livewire-aware trait with reactive $cartItems, $cartTotal, $cartSubTotal, $cartCount properties and proxy methods - @joelwmale
  • ShareCartWithInertia - static helper for sharing cart state via HandleInertiaRequests::share() - @joelwmale
  • cart:install Artisan command - publishes config and scaffolds app/Cart/ directory structure - @joelwmale
  • cart:make:coupon, cart:make:tax, cart:make:shipping, cart:make:driver Artisan commands - generate typed stub classes - @joelwmale
  • cart:debug Artisan command - dumps current cart state (non-production only) - @joelwmale
  • applies_to support on item conditions - limit a condition to the first N units of a line item - @joelwmale
  • PHPStan level 5 static analysis with zero errors, run in CI on PHP 8.3 - @joelwmale
  • Laravel 13 support - @joelwmale

Changed

  • Cart constructor now accepts a CartDriver instance instead of raw session/database storage; applications using the service container are unaffected - @joelwmale
  • Config publish tag renamed from config to cart-config to avoid conflicts with other packages - @joelwmale
  • CartSession removed and replaced by the driver system - @joelwmale

Fixed

  • Redis driver TTL units corrected from minutes to seconds - @joelwmale
  • CartFacade @mixin and @method PHPDoc restored for IDE and PHPStan support - @joelwmale
  • Missing return type added to getAssociatedModel - @joelwmale
  • Null-safe json_decode in RedisDriver - @joelwmale
  • Conditions now serialized to arrays before storage, preventing serialization inconsistencies across drivers - @joelwmale
  • Guard against null writes in SessionDriver::setSessionKey - @joelwmale
  • cart:make:* commands now validate class name input and check for file write failures - @joelwmale

Contributors