leaphly/cart-bundle
Leaphly Cart Bundle is a Symfony bundle that adds reusable shopping cart functionality to PHP applications. It includes cart and line-item models, a cart manager, Doctrine persistence, and extension points for custom products, pricing, and checkout integration.
Architecture fit — a Symfony 2 bundle, not a Laravel package; relevant only as a domain blueprint.
Despite being catalogued as a Laravel/PHP package, Leaphly CartBundle is a Symfony full-stack bundle. It registers services via DependencyInjection/*Extension and compiler passes, hooks HttpKernel events, and exposes HTTP via FOSRestBundle + JMSSerializer + Twig. Laravel has no bundle system, no compiler passes, no HttpKernel. There is no conventional path to composer require and boot this in a Laravel app.
What is directly useful is the domain architecture: a cart aggregate (cart → cart item → product/variant reference), a guarded state machine (cart → wishlist → ordered), pluggable price/item resolvers, and event dispatch on cart mutation. Those concepts translate cleanly to Laravel idioms (Eloquent, spatie/laravel-model-states or a transition table, pipeline calculators, Laravel events). The realistic fit, from a TPM framing, is reference material for a build decision, not a dependency.
Integration feasibility — low for adoption, moderate for extraction.
Doctrine\Common\Collections, Symfony EventDispatcher/Form/Validator/OptionsResolver, and FOSRestBundle/JMSSerializer/Twig. None of these integrate into a Laravel request lifecycle without a compatibility shim.Technical risk — high, dominated by abandonment.
composer conflicts on the first install attempt against a modern Laravel lockfile.composer.json PHP/Symfony constraints, CI status, test coverage, license, and whether any fork has modernized it.Key questions for the team
Recommendation: Do not adopt as a runtime dependency. Fund a short extraction spike and treat the bundle as an architectural reference.
Stack fit — none at runtime. A modern Laravel stack (PHP 8.x, Laravel 10/11, Eloquent, Illuminate events/queues) is structurally incompatible with a Symfony 2 bundle pinned to PHP 5.x-era constraints and Doctrine 2.x-era APIs. There is no supported version matrix where both coexist cleanly.
Migration path — harvest, don't port.
carts, cart_items, cart_item_variants tables; a state column with explicit transition guards; a CartCalculator pipeline for line price, tax, discounts; domain events (CartItemAdded, CartStateChanged).updated_at guard) on cart writes — the bundle's guard logic does not address concurrent session writes.Compatibility — blocking for direct adoption.
Expect composer conflicts on doctrine/orm, symfony/*, jms/serializer, and friendsofsymfony/rest-bundle. Even if resolved in isolation, PHP constraints typically exclude modern runtimes. Verify composer.json first; a php: >=5.3,<5.5-style constraint closes the direct-adoption path in minutes.
Sequencing
composer why-not in a scratch branch) — a two-hour test that validates or kills direct adoption.Do not run dual carts in production — two systems of record for the same user session is a defect generator.
Maintenance — the dominant cost. Upstream is effectively frozen. Adopting means forking, owning, and patching: PHP upgrades, dependency bumps, security backports — a permanent tax versus owning ~2,000 lines of Laravel-native code. The zero-dependents signal also means no external bug reports to free-ride on.
Support — none. No vendor, no active maintainers, no Laravel community around it (there is no Laravel use case). Internal documentation is written from scratch. The escalation path is "the person who read the source."
Scaling — addressed by the reimplementation, not the package.
Cart workloads are write-heavy and spiky (add/remove/quantity churn), and the bundle's persistence is straightforward relational writes. A native build should keep carts in Redis/Postgres with a TTL, persist durably on checkout intent, and index on user_id/session_id. Running the bundle would introduce a second ORM/connection pool to tune and monitor for no benefit.
Failure modes to plan for
composer update six months in becomes multi-day archaeology.Ramp-up
A team unfamiliar with Symfony 2 idioms (compiler passes, services.yml, annotation routing, Doctrine UnitOfWork) needs ~1–2 weeks just to read the source productively — and that investment yields a design document, not shippable code. A Laravel-native cart is ~2–3 weeks for a mid-level engineer with existing Eloquent experience: comparable effort, materially better outcome and ownership. The ramp-up only pays off if the bundle is treated as documentation, which is the recommended posture.
How can I help you explore Laravel packages today?