Download the PHP package ashraam/laravel-simple-cart without Composer
On this page you can find all versions of the php package ashraam/laravel-simple-cart. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download ashraam/laravel-simple-cart
More information about ashraam/laravel-simple-cart
Files in ashraam/laravel-simple-cart
Package laravel-simple-cart
Short Description Simple session based cart for Laravel 12
License MIT
Homepage https://github.com/ashraam/laravelsimplecart
Informations about the package laravel-simple-cart
Laravel Simple Cart
A simple session-based shopping cart implementation for Laravel 12. This package provides an easy way to add shopping cart functionality to your Laravel application without the need for a database.
Installation
You can install the package via composer:
Usage
The package provides a simple API to manage your shopping cart:
Item Structure
When retrieving an item using Cart::get()
, the returned array will have this structure:
Price Calculations
The cart provides several methods to calculate prices:
subtotal()
: Returns the sum of all items (price × quantity)totalFees()
: Returns the sum of all added feestotalDiscounts()
: Returns the sum of all added discountstotal()
: Returns the final total calculated as: subtotal + fees - discounts
Managing Fees and Discounts
Fees and discounts are stored separately from items and persist until explicitly removed or the cart is cleared.
Each fee and discount is stored with a name and amount. The name is used as a unique identifier when removing the fee or discount.
Configuration
You can publish the configuration file with:
This will create a config/laravelsimplecart.php
file where you can modify the cart settings:
Changelog
Please see CHANGELOG for more information what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
Credits
- Romain BERTOLUCCI
- All Contributors
License
The MIT License (MIT). Please see License File for more information.
Laravel Package Boilerplate
This package was generated using the Laravel Package Boilerplate.