jord-jd/laravel-extendable-basket
An extendable shopping basket for Laravel. Offers a flexible cart with swappable storage, pluggable item handlers, and customizable pricing and discount rules, letting you tailor basket behaviour to your app without rewriting core logic.
Architecture fit: The package fits Laravel applications that need a lightweight, Eloquent-backed basket/cart abstraction with polymorphic “basketable” models. Laravel 11–13 support makes it viable for current greenfield or modernized applications; retained Laravel 5.5 support signals legacy compatibility but also broadens the support surface.
Integration feasibility: Integration is likely straightforward for Laravel teams: Composer install, package discovery/service provider, migrations, and Eloquent model relationships. The new clear() method and deterministic add() return value improve API ergonomics. Morph-map alias support is a meaningful fit improvement for applications already using Laravel’s morph map.
Technical risk: The main risks are behavioral, not architectural. “Automatically persist a manually constructed basket when its first item is added” changes lifecycle semantics and can create records earlier than callers expect. Returning a basket item from add() may break callers that relied on a previous return value. Rejecting unsaved basketable models is safer but stricter. Retaining a PHP 7.1 runtime floor and Laravel 5.5 support exposes the package to EOL platform/security concerns, even if the CI matrix passes. Skipping orphaned polymorphic rows improves resilience but may hide data-integrity issues.
Key questions:
add() return change backward-compatible for existing consumers, or should it be treated as breaking?clear() enforce authorization/policy at the application layer, or only data deletion?Stack fit: Best fit is a Laravel application using Eloquent, Composer, and polymorphic relationships for products/catalog entities. Modern Laravel 11–13 applications should integrate cleanly; legacy Laravel 5.5–10 applications are technically supported but should be treated as compatibility paths, not strategic targets.
Migration path: Pin v6.1.0, review the release for add() return-value and auto-persist behavior, run package migrations, configure morph-map aliases if used, and add regression tests around basket creation, item merge, orphaned rows, and clear(). If upgrading from an earlier package version, explicitly test code paths that construct baskets manually before adding items.
Compatibility: The Laravel 5.5-through-13 matrix and passing GitHub Actions are positive signals. However, PHP 7.1 as the floor means the package can run on EOL PHP; products with security/compliance requirements should constrain to supported PHP versions. Laravel 13 support should be validated against the exact Laravel 13 release/composer constraints used by the product.
Sequencing: 1) Confirm package and PHP/Laravel version constraints; 2) install in a branch; 3) publish/run migrations; 4) configure morph map; 5) update application code for add() return semantics and unsaved-model exceptions; 6) add integration tests for auto-persist and orphan handling; 7) stage with representative catalog data; 8) roll out behind normal release process.
Maintenance: Broad Laravel/PHP compatibility increases maintenance and test-matrix burden. The refreshed GitHub Actions matrix is a strong operational improvement, but the team should monitor whether legacy Laravel/PHP support receives timely security updates.
Support: Documentation refresh and CI replacement reduce onboarding friction. Support cases are likely to concentrate around basket lifecycle expectations, morph-map alias mismatches, and orphaned polymorphic data.
Scaling: clear() in one query is efficient for bulk removal. Basket matching and quantity merges should be backed by appropriate indexes on basket and polymorphic columns. Concurrent add/merge operations may need transaction or uniqueness safeguards to avoid duplicate or lost quantity updates.
Failure modes: Unsaved basketable models now raise a clear exception; manual baskets may persist earlier than expected; orphaned polymorphic rows may be skipped during matching, causing apparent missing items; orphaned item price access raises a clear error; morph alias changes can break matching if not migrated consistently; clear() can remove all items and should be authorization-gated by the host application.
Ramp-up: Low-to-moderate. The API is Laravel-idiomatic and documentation is refreshed, but the auto-persist and add() return changes require developers to re-read usage patterns and update tests rather than assuming prior behavior.
How can I help you explore Laravel packages today?