Download the PHP package saasify/shopping-cart without Composer
On this page you can find all versions of the php package saasify/shopping-cart. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download saasify/shopping-cart
More information about saasify/shopping-cart
Files in saasify/shopping-cart
Package shopping-cart
Short Description Shopping cart package for Laravel
License MIT
Informations about the package shopping-cart
Saasify Cart
A simple cart for Laravel. Might be oppinionated for Saasify/Saasify, but should work for any other projects.
Laravel | PHP | Shopping Cart |
---|---|---|
9.x | 8.x | 9.0 |
8.x | 7.4 | 9.0 |
8.x | 8.0 | 9.0 |
6.x | 8.0 | 9.0 |
6.x | 7.4 | 9.0 |
Install
Install via composer
Publish configuration file and migrations
Edit config/cart.php if necesarry
Run migrations
Overview
- Usage
- Instances
- Storage
- Coupons
Usage
The shopping cart gives you the following methods to use:
Cart::add()
Add an item to the shopping cart.
Cart::remove()
Remove the item with the specified unique id from the shopping cart. Unique id
is used to store items with the same $id
, but different $options
.
Cart::has()
Check if the shopping cart contains the item with the specified unique id.
Cart::get()
Get an item in the shopping cart by its unique id.
Cart::content()
Get all items in the shopping cart.
Cart::clear()
Clear the shopping cart.
Cart::count()
Return number of items in the shopping cart. This method does not summarize quantities of item. For example, there are 3 books and 1 iPhone in the shopping cart, so this method returns 2.
Cart::getTotal()
Return total price of all items in the shopping cart.
Instances
The package supports multiple instances of the cart. Some examples:
The default cart instance is called default
, so when you're not using
instances,Cart::content();
is the same as Cart::instance('default')->content()
.
Cart::instance()
Set current instance name.
Cart::currentInstance()
Get current instance name.
Storage
Currently there are two possible storage to persist shopping cart:
- Database
- Redis
You can choose one by specifying repository class name in config
Cart::store()
Persist current shopping cart instance to storage.
Cart::restore()
Restore shopping cart instance to storage.
Cart::destroy()
Remove shopping cart instance from storage.
Coupons
You can easily add discount coupons to shopping cart. Currently there are two types of coupons:
- FixedDiscountCoupon
- PercentDiscountCoupon
Related methods:
Cart::addCoupon()
Add coupon to cart.
Cart::coupons()
Returns all coupons.
Cart::getTotalWithCoupons()
Returns total price with applied coupons.
Security
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
Credits
- Madalin Ignisca
Original developers
- Alexander Melihov
- All contributors
All versions of shopping-cart with dependencies
ext-json Version *
illuminate/container Version ^6.0|^8.0|^9.0
illuminate/database Version ^6.0|^8.0|^9.0
illuminate/redis Version ^6.0|^8.0|^9.0
illuminate/support Version ^6.0|^8.0|^9.0