Download the PHP package nhanchaukp/laracart without Composer
On this page you can find all versions of the php package nhanchaukp/laracart. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download nhanchaukp/laracart
More information about nhanchaukp/laracart
Files in nhanchaukp/laracart
Package laracart
Short Description Enhanced Laravel shopping cart package with multiple storage drivers
License MIT
Informations about the package laracart
![]()
LaraCart
LaraCart is a Laravel package that provides a flexible and extensible shopping cart system. It supports multiple storage drivers (e.g., database, session) and offers a wide range of features for managing shopping carts in your Laravel application.
Features
- Multiple storage drivers (Database, Session)
- Add, update, and remove items from the cart
- Support for polymorphic itemable models
- Discount management
- Assign carts to users
- Clear and count items in the cart
- Retrieve cart totals and quantities
Installation
-
Install the package via Composer:
-
Publish the configuration and migration files:
-
Run the migrations:
- Configure the driver in
config/laracart.php(default:database).
Usage
Basic Usage
Add an Item to the Cart
Retrieve the Cart
Get All Items
Remove an Item
Clear the Cart
Advanced Features
Set a Discount
Assign Cart to a User
Switch Drivers
Configuration
The configuration file config/laracart.php allows you to customize the following:
driver: The storage driver (databaseorsession).session_key: The session key for the session driver.currency: The default currency.models: Custom models forCartandCartItem.cookie: Cookie settings for guest users.
Models
Cart
The Cart model represents a shopping cart and includes the following attributes:
user_id: The ID of the user associated with the cart.session_id: The session ID for guest users.discount_percent: The discount percentage applied to the cart.total: The total price of the cart.
CartItem
The CartItem model represents an item in the cart and includes the following attributes:
cart_id: The ID of the cart.itemable: Polymorphic relation to the itemable model.quantity: The quantity of the item.price: The price of the item.options: Additional options for the item.
License
This package is open-sourced software licensed under the MIT license.
All versions of laracart with dependencies
illuminate/support Version ^10.0|^11.0|^12.0
illuminate/database Version ^10.0|^11.0|^12.0