Download the PHP package binafy/laravel-cart without Composer
On this page you can find all versions of the php package binafy/laravel-cart. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download binafy/laravel-cart
More information about binafy/laravel-cart
Files in binafy/laravel-cart
Package laravel-cart
Short Description Laravel Cart is a customizable package for adding shopping cart functionality to Laravel applications
License MIT
Homepage https://github.com/binafy/laravel-cart
Informations about the package laravel-cart
Laravel Cart

- Introduction
- Features
- Installation
- Publish
- Usage
- Configuration
- Laravel Cart Facade
- Driver
- Support Drivers
- Laravel Cart Model
- Store Cart
- Access Itemable
- Create Cart With Storing Items
- Store multiple items
- Store Item For a Cart
- Delete Item From Cart
- Delete All Items From Cart
- Increase Quantity
- Decrease Quantity
- Available Events
- Contributors
- Security
- Changelog
- License
- Donate
Introduction
The Laravel Cart
is a highly customizable and flexible package that integrates basket functionality into your Laravel application. It simplifies storing and managing cart items, supporting multiple item types and quantities. It is ideal for e-commerce platforms to create carts, attach items, and manage them efficiently. Installation is straightforward via Composer, and it offers robust features like secure item storage, easy cart manipulation, and seamless integration with your existing Laravel app.
Features
The Laravel Cart
package is an ideal choice for developers looking to implement a reliable and scalable cart system in their Laravel-based e-commerce applications:
- Item Management: Easily add, update, and remove items from the cart with an intuitive API.
- Attributes and Options: Define custom attributes and options for cart items to handle variations like size and color.
- Tax Calculation: Built-in support for tax calculations, enabling automatic tax application based on predefined rules.
- Discounts and Coupons: Integrate discount codes and coupon functionalities to offer promotions and special offers to customers.
- Session and Database Storage: Flexible storage options allow carts to be stored in sessions or the database.
- Events and Listeners: Hook into various cart events with listeners to perform actions like logging or triggering additional business logic.
- Customizable: Extend and customize the core functionalities to meet specific business requirements.
- Easy Integration: Designed to integrate seamlessly with existing Laravel projects, providing a smooth development experience.
Installation
You can install the package with Composer:
Publish
If you want to publish a config file, you can use this command:
If you want to publish the migrations, you can use this command:
For convenience, you can use this command to publish config, migration, and ... files:
After publishing, run the php artisan migrate
command.
Usage
Configuration
You can config the Laravel Cart
with laravel-cart.php
config that exists in config
folder.
Laravel Cart Facade
For convenience, you can use Laravel Cart facade to store, delete, and ...:
Driver
If you may to using Laravel Cart facade, you can change the driver for store, delete, and ...:
The default driver is
database
and if you would to change the driver, you need to use the Laravel Cart config file that exists onconfig\laravel-cart.php
.
Support Drivers
Drivers | Name |
---|---|
Session | session |
Database | database |
Laravel Cart Model
Also, you are able to use Laravel Cart models for fetch or ... with Laravel Eloquent.
Store Cart
For storing a new cart, you can use Cart
model:
Access Itemable
If you want to access to itemable in CartItem
, you can use itemable
relation:
Create Cart With Storing Item
For storing an item for cart, you need to implement
Cartable
interface to your model.
After, you can store items in multiple ways:
Store multiple items
If you may to store multiple items for a cart, you can use storeItems
method:
Store Item For a Cart
If you want to store items for cart, first you need to create a cart and attach items to cart:
If you may to access the items of one cart, you can use items
relation that exists in Cart model.
For conveniences, you can use storeItem
method. This method take a model or array:
Delete Item From Cart
If you may to delete an item for a cart, you can use removeItem
method:
Delete All Items From Cart
If you may to delete all items from a cart, you can use emptyCart
method:
Increase Quantity
If you may to increase the quantity of item in cart, you can use increaseQuantity
method:
Decrease Quantity
If you may to decrease the quantity of item in cart, you can use decreaseQuantity
method:
Available Events
The Laravel Cart
have some events that you can listen to these event and doing something:
Events | Description |
---|---|
LaravelCartStoreItemEvent |
When you store an item in cart, this event fired |
LaravelCartRemoveItemEvent |
When you remove an item from cart, this event fired |
LaravelCartEmptyEvent |
When you remove all items from cart, this event fired |
LaravelCartIncreaseQuantityEvent |
When you increase the quantity of item in cart, this event fired |
LaravelCartDecreaseQuantityEvent |
When you decrease the quantity of item in cart, this event fired |
Contributors
Thanks to all the people who contributed. Contributors.
Security
If you discover any security-related issues, please email [email protected]
instead of using the issue tracker.
Changelog
The changelog can be found in the CHANGELOG.md
file of the GitHub repository. It lists the changes, bug fixes, and improvements made to each version of the Laravel User Monitoring package.
License
The MIT License (MIT). Please see License File for more information.
Donate
If this package is helpful for you, you can buy a coffee for me :) ❤️
- Iraninan Gateway: https://daramet.com/milwad_khosravi
- Paypal Gateway: SOON
- MetaMask Address:
0xf208a562c5a93DEf8450b656c3dbc1d0a53BDE58