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 Cart Laravel Package

wearepixel/laravel-cart

A Laravel shopping cart package for managing cart items, quantities, prices, and totals with flexible storage options. It provides a simple API for adding, updating, and removing items, making it easy to integrate into ecommerce checkout flows.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture fit

  • The headline change is a pluggable storage driver abstraction (CartDriver + CartManager with Session/Database/Redis/Null/Multi implementations). This is the right architectural move: cart state stops being an implicit session concern and becomes an explicit, swappable dependency. For anything beyond a single-node monolith this is the difference between "can't scale" and "can scale".
  • The first-class Coupon / TaxRule / ShippingRate abstract classes are a meaningful domain-modelling upgrade. They formalise concepts that were previously ad-hoc CartCondition construction scattered across application code, and they convert down to CartCondition so the existing condition engine is preserved. Low architectural risk, high readability payoff.
  • MultiDriver is the most strategically interesting addition — it implies read/write composition (e.g. Redis hot path + Database durability). The release notes do not describe its consistency semantics, which is a gap.
  • The Cart::fake() + CartFactory + assertion methods harness is genuinely valuable for a TPM: it means downstream teams write less bespoke test scaffolding against a package they don't own. It also raises coverage of the package's own contract.

Integration feasibility

  • Claimed "existing code continues to work unchanged - the new features are additive" is not accurate as written. Three changes are breaking:
    1. CartSession is removed and replaced by the driver system. Any direct instantiation, type-hint, extension, or container binding of CartSession breaks.
    2. The Cart constructor signature changed (now takes a CartDriver). Container-resolved usage is fine; new Cart(...), factory overrides, or test doubles that construct it directly will break.
    3. The config publish tag renamed config → cart-config. Deploy scripts using vendor:publish --tag=config will silently stop publishing the cart config — a silent failure mode, not a loud one.
  • Treat this as a major upgrade with a real migration step, not a drop-in.

Technical risk

  • Redis TTL fix is production-visible. Correcting units from minutes to seconds means any existing configured TTL value is now interpreted as up to 60x shorter. Carts will expire far earlier than before the deploy. This must be audited before release, not after.
  • Condition serialization change (conditions serialized to arrays before storage) means carts persisted before the upgrade may contain PHP-serialized objects that the new code path reads differently. In-flight carts at deploy time are the risk window — silent data loss or a thrown deserialization error.
  • PHPStan level 5 with zero errors is good hygiene but modest (level 5 of 9). It's a floor, not a guarantee. The restored @mixin/@method PHPDoc is arguably more valuable day-to-day for IDE and static analysis in consuming apps.
  • Laravel 13 support is claimed. If Laravel 13 is not GA at release time, this is forward-compatibility claims against an unreleased framework — verify it is tested against a stable target, not a nightly.
  • Single contributor on a major release that removes a class and changes constructors. Bus factor and review depth are the standing concerns.
  • cart:debug is stated as non-production only; confirm the guard is environment-based and not something an operator can trivially flip.

Key questions

  1. Is there a published upgrade guide covering CartSession removal, constructor injection, and the publish-tag rename?
  2. What are the minimum PHP and Laravel versions? Is Laravel 13 support against GA or pre-release?
  3. Does DatabaseDriver ship publishable migrations? What is the schema, and how are schema changes versioned going forward?
  4. What is the MultiDriver read/write and fallback semantics — consistency model, failure behaviour when the primary is unavailable?
  5. How should teams handle carts persisted before the serialization change? Is there a migration command, or is a drain-and-deploy required?
  6. What is the intended TTL configuration contract post-fix — where is it set, and what units are now authoritative?
  7. Support policy and release cadence: is there a commitment to backport security fixes, and to which majors?

Integration Approach

Stack fit

  • Strong fit for Laravel applications on the current LTS line, particularly:
    • Monoliths on a single node — SessionDriver preserves current behaviour with a config change; low-effort adoption.
    • Multi-node / containerised deployments — RedisDriver or DatabaseDriver removes the sticky-session constraint on carts. This is the primary reason to take the upgrade.
    • Livewire and Inertia front-ends — HasCart and ShareCartWithInertia remove hand-rolled glue that most teams currently maintain themselves.
  • The HasCart trait is Livewire-aware with reactive properties, which is convenient but couples components to the package's reactivity model. Acceptable; flag it in code review.

Migration path

  • Sequence matters. Recommended order:
    1. Inventory all CartSession references, direct Cart construction, custom container bindings, and vendor:publish --tag=config usage across repos and CI.
    2. Audit Redis TTL configuration in every environment, staging included. Recompute values for seconds. This is the highest-risk item and is independent of everything else.
    3. Rename publish tags in deploy pipelines and confirm config is still landing in config/.
    4. Drain or tolerate in-flight carts around the deploy that changes condition serialization. Simplest safe option: deploy during a cart-abandonment window, or accept a one-time cart reset and communicate it.
    5. Switch storage via config, not code. Keep SessionDriver on day one to isolate the upgrade from the storage change.
    6. Adopt the test harness in existing test suites opportunistically — new tests first, retrofits later.
  • The cart:install command scaffolds app/Cart/; use it as a reference rather than running it blind into an existing codebase with established conventions.

Compatibility

  • Additive features are safe to adopt incrementally; the three breaking changes are not. Budget one focused upgrade ticket, not a background chore.
  • Any package or first-party module that extends Cart or mocks CartSession needs a coordinated change.
  • If the team has a custom storage implementation today (file, DynamoDB, custom table), it must be rewritten as a CartDriver. That is the single largest unknown-effort item. Size it before committing to the upgrade.

Sequencing recommendation

  • Phase 1: upgrade + config tag + Redis TTL audit, still on SessionDriver. Ship and observe.
  • Phase 2: migrate storage to RedisDriver or DatabaseDriver behind config, with cart:debug verification in staging.
  • Phase 3: adopt testing harness in CI for any new cart-touching features.
  • Phase 4: adopt Coupon/TaxRule/ShippingRate classes to replace bespoke condition construction, one concept at a time.
  • Phase 5: Livewire/Inertia integration if the front-end warrants it.

Operational Impact

Maintenance

  • Positive: CI-enforced static analysis, SemVer-respecting major bump, a real changelog with per-item attribution. This is a well-run release by hobby-package standards.
  • Negative: single maintainer across all entries. No evidence of second-reviewer sign-off on a release that removes a public class. Adopt with a fork-and-patch contingency in mind; keep the pinned version range narrow.
  • The added surface area (drivers, abstract classes, Artisan commands, two front-end integrations) is a lot for one maintainer to keep current. Expect slower patch cadence going forward, not faster.

Support

  • cart:install and the cart:make:* generators reduce onboarding friction and standardise structure — good for support load.
  • Input validation and file-write failure checks on generators are a small but telling quality signal.
  • cart:debug is a genuine operational aid for staging triage. Confirm its production guard.
  • Expect internal support questions concentrated in two areas: driver configuration and TTL semantics. Write a short internal runbook for both.

Scaling

  • This is the release's core operational win. Moving carts off the session store decouples cart state from request affinity, enabling horizontal scaling and rolling deploys without session loss.
  • RedisDriver gives low-latency shared state; DatabaseDriver gives durability and queryability at higher latency. MultiDriver potentially gives both, but its semantics are undocumented — do not design against it until clarified.
  • applies_to on item conditions (limit a condition to the first N units) is a small feature with real correctness value for tiered promotions and per-unit tax.

Failure modes

  • Redis unavailable → if RedisDriver is the sole driver, cart operations fail hard. Decide the degradation story (fallback driver, graceful 503, or read-only cart) before switching.
  • NullDriver shipped to production → carts silently never persist. Guard via config validation at boot, not by convention.
  • Redis TTL misconfiguration → premature cart expiry, high support volume, hard to attribute to a deploy. Metrics on cart-expiry rate are worth adding.
  • Deploy mid-flight → serialization change plus CartSession removal can break active carts. Mitigate with drain or an accepted one-time reset.
  • Silent config regression → publish-tag rename fails quietly; new environments may boot with package defaults. Assert config presence in a smoke test.
  • MultiDriver divergence → unreachable or stale secondary producing inconsistent cart reads. Unknown risk until semantics are documented.

Ramp-up

  • For a team already using the package: roughly 1–2 days to read the upgrade guide, adjust construction and publish scripts, and validate staging; plus a Redis TTL audit if Redis is in play.
  • For a custom storage implementation: add 3–5 days of engineering to author and validate a CartDriver.
  • Team knowledge needed: Laravel service container and driver/manager patterns (already familiar to most Laravel engineers), plus the package's condition model.
  • The testing harness lowers the ramp for new contributors meaningfully — new tests can seed cart state declaratively instead of through the domain layer.
  • Recommend a single named owner for the upgrade and a short internal write-up on driver choice, TTL policy, and the production guard on cart:debug. Without that, the knowledge sits with whoever did the migration.
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.
elmogy/larafast
xeviant/laravel-paystack
gorilladash/laravel-website-sdk
martialbe/flysystem-oss
chondal/3312client
jeroen-g/flickr
opscale-co/nova-genbi
itsjustvita/laravel-retention
tequilarapido/trackit
gregsphotography/site-builder-filament
cabaoctavio/laravel-query-log
gregsphotography/site-builder-components
io-digital/clickatell
snowsoft/laravel-admin
oxygen/auth
relicsoftware/barakah-payment-gateway
tobya/work-with-composer
equipc/laravel-email-validator
equipc/laravel-email-database-log
adedsec/nova-translated-labels