Download the PHP package ingenius/shopcart without Composer
On this page you can find all versions of the php package ingenius/shopcart. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package shopcart
Ingenius ShopCart
A Laravel package for implementing shopping cart functionality with modifiers support.
Installation
Features
- Add products to cart (supports polymorphic relationships)
- Remove products from cart
- Delete cart items
- Get cart items
- Cart modifiers system for extending functionality
- Session-based cart for guests
- User-based cart for authenticated users
Configuration
Environment Variables
Note: For backward compatibility,
SHOPCART_PRODUCT_MODELis still supported butPRODUCT_MODELis preferred as it's used across all packages.
ShopCart Modifier System
The ShopCart package includes a modifier system that allows other packages to extend the cart's functionality without the ShopCart package needing to know about them.
Features
- Add custom calculations to the cart total (shipping, discounts, taxes, etc.)
- Extend the cart's JSON/array output with additional data
- Control the execution order of modifiers using priorities
- Easy to implement in other packages
How It Works
The ShopCart uses a pipeline approach with modifiers that:
- Calculate subtotals in priority order (lower numbers run first)
- Extend the
toArray()output with custom values from each modifier - Allow precise control over execution order
Creating Your Own Modifier
To create a new cart modifier in your package:
- Create a class that extends
BaseCartModifieror implementsCartModifierInterface - Set its priority to control when it runs (lower = earlier)
- Register it with the
CartModifierManagerin your package's service provider
Example Modifier
Registering Your Modifier
In your package's service provider:
Command Line Tools
The ShopCart package includes command line tools to help you manage and debug cart modifiers.
Listing Registered Cart Modifiers
To view all registered cart modifiers and their priorities, use the following command:
Usage
Testing
License
The MIT License (MIT). Please see License File for more information.