gloudemans/shoppingcart
Laravel Shoppingcart is a simple, flexible cart package for Laravel. It supports multiple cart instances, item attributes, conditions like discounts and VAT, and pluggable storage drivers including sessions and databases. Easily add, update, and remove items and calculate totals.
Architecture fit. gloudemans/shoppingcart is a monolith-oriented, session-backed cart library. It assumes a traditional Laravel MVC application where the cart lives in the user's session (Cart::add(), Cart::content(), Cart::total()), which is a tight coupling to server-side session state and a single Laravel application instance. This is an acceptable fit only for a conventional server-rendered Laravel storefront or a small-to-medium commerce site that already owns the request lifecycle. It is a poor fit for API-first, headless, or multi-service architectures, for guest-cart persistence across devices, or for any setup that needs cart state to survive load balancing without a shared session store. The package does not model pricing rules, tax engines, promotions, inventory, or currency beyond a basic Tax/Coupon style flow, so it is a cart primitive, not a commerce platform.
Integration feasibility. Installation is a straightforward Composer require plus service-provider registration and a published config file. The API is simple and well documented historically, and 3.7k stars mean a large body of tutorials, Stack Overflow answers, and community examples exist. The practical blocker is version drift: the last release was February 2019, which predates Laravel 6+ and PHP 7.4+/8.x. On a current Laravel 10/11/12 application, Composer will almost certainly reject the package's illuminate/* constraints, so integration requires either pinning an old framework (unacceptable) or forking/updating the constraints and validating behavior on PHP 8.2+. That fork effort is small in code surface but nonzero in test coverage, because the library has no maintained test suite against modern PHP.
Technical risk. The dominant risk is abandonment, not design. No releases since 2019 means no security patches, no PHP 8 compatibility guarantees, and no response to Laravel lifecycle changes (session driver behavior, container changes, facade registration). Secondary risks: session-based storage caps cart size and correctness under concurrency and horizontal scaling; monetary math uses floats rather than integer minor units, which is a rounding risk for tax and totals at scale; and the zero-dependents signal suggests it is not being actively pulled into new greenfield projects, which makes community support a shrinking asset. The MIT license is permissive and low-risk, so forking is legally clean — this is the most important mitigating fact.
Key questions. Which Laravel LTS and PHP versions does the target application run, and can the package's constraints be satisfied without downgrading? Is the cart state allowed to live in session, or does the business need a persistent/server-authoritative cart? Who will own the fork, and is there an appetite to maintain it against future Laravel majors? Does the existing session driver (file, Redis, database) meet the concurrency and scaling requirements? Are there compliance or audit requirements that make an unmaintained dependency unacceptable?
Stack fit. Treat this as a fit for a Laravel monolith or a Laravel-as-backend-for-Blade/Vue storefront where sessions are already used for auth and CSRF. Do not adopt it for a headless commerce build, a multi-tenant SaaS, or a marketplaces/OMS integration without wrapping it behind an internal CartService interface so it can be swapped. The package should sit behind a domain boundary — controllers and views call your service, your service calls the package — so its session coupling does not leak into product code.
Migration path. For existing applications already on this package, the migration is a "contain and plan" path: wrap calls behind an adapter, add characterization tests around totals, tax, and coupon behavior, then evaluate replacement (a maintained fork, darryldecode/cart, or a custom cart domain model) as a separate workstream. For greenfield adoption, do not install the upstream release on a modern Laravel; instead fork, bump illuminate/* and php constraints, run the package's tests plus your own, and pin the fork via VCS repository in composer.json. Keep the fork in the same repo namespace so future swaps remain cheap.
Compatibility. Verify against the specific Laravel LTS target and PHP minor version. The known friction points are facade/service-provider registration conventions, session API signatures, and any use of deprecated helpers or Str/Arr behavior. Because the library touches money, run a numeric round-trip test suite on PHP 8.x for float precision and locale formatting before trusting it in checkout. Front-end compatibility is trivial — it is server-side only — but the session cookie and CSRF assumptions must match your actual storefront auth model, including guest carts.
Sequencing. (1) Confirm stack constraints and the version matrix. (2) Fork and modernize constraints, add CI on target PHP/Laravel. (3) Introduce the internal CartService interface and route all existing calls through it. (4) Build characterization tests covering add/update/remove/coupon/tax/totals and session behaviors. (5) Run a canary in a non-critical flow (e.g., a staging storefront) to validate session scaling. (6) Decide on long-term ownership: maintain the fork, or schedule a replacement behind the same interface. Do not sequence a cart replacement in the same release as a framework upgrade.
Maintenance. Upstream is effectively dormant (no release in roughly six years), so the team must budget for fork maintenance: dependency bumps on each Laravel major, PHP version bumps, and periodic security review of the (small) codebase. Because the surface area is modest — cart operations over session data — ongoing maintenance is low-hours but recurring, and the risk is that it silently rots between Laravel majors and surfaces during a framework upgrade. Assign a named owner and a review cadence tied to Laravel release schedule.
Support. There is no vendor. Support is community-only (GitHub issues, historical Stack Overflow answers), and the zero-dependents signal indicates a declining community footprint, meaning answers will age. For a TPM this translates to higher internal support load: your team becomes the de facto maintainer for any bug that affects checkout. Document internal ownership and escalation in the runbook.
Scaling. Session-backed carts scale with the session store, not the cart package. File-based sessions will not survive horizontal scaling; Redis or database sessions are required for multi-instance deployments, and session size limits (Redis value size, cookie size if client-side) cap large carts. Throughput is generally fine for typical storefront traffic, but checkout-path concurrency (double-add, coupon race) is not handled by the package — it relies on session semantics — so any real concurrency guarantee must be added at the service layer. Multi-region or multi-device cart continuity is out of scope and would require a persistent cart store.
Failure modes. Expected failures: Composer dependency conflict on modern Laravel; session driver misconfiguration causing lost or shared carts; float rounding drift in totals or tax under many line items; coupon/tax logic edge cases that were never covered by tests; silent behavioral changes when forking because there is no maintained test suite; and abandonment risk where a future Laravel major breaks the facade and no upstream fix arrives. Each is recoverable, but the rounding and session-isolation failures are customer-visible and should be treated as checkout-critical.
Ramp-up. Developer ramp-up is short — the API is small and idiomatic, and historical docs are abundant — so a mid-level Laravel engineer is productive within a day. The real ramp-up cost is organizational: someone must own the fork and the replacement decision, and reviewers must understand the session-scaling and monetary-precision caveats. Budget roughly one sprint of engineering for forking, testing, and adapter introduction before any production reliance, and treat that as the true cost of adoption rather than the one-line Composer install.
How can I help you explore Laravel packages today?