PHPackages                             revotale/shopping-cart - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. revotale/shopping-cart

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

revotale/shopping-cart
======================

PHP library providing basic shopping cart object and interfaces to implement any type of cart items + promotions combination.

0.4.0(1y ago)23.4k↓60.2%[1 issues](https://github.com/RevoTale/php-shopping-cart/issues)[3 PRs](https://github.com/RevoTale/php-shopping-cart/pulls)MITPHPPHP ^8.3CI passing

Since Dec 4Pushed 2w agoCompare

[ Source](https://github.com/RevoTale/php-shopping-cart)[ Packagist](https://packagist.org/packages/revotale/shopping-cart)[ RSS](/packages/revotale-shopping-cart/feed)WikiDiscussions main Synced 2d ago

READMEChangelog (10)Dependencies (4)Versions (19)Used By (0)

RevoTale Shopping Cart
======================

[](#revotale-shopping-cart)

A powerful and flexible PHP library for implementing shopping cart functionality with advanced promotion system and precise decimal calculations.

**Notice!** This README was "vibe coded". If you encouter any errors please feel free to open the issue.

[![PHP Version](https://camo.githubusercontent.com/c9f64f714c636ba27a3bba6dfd52f98426832db1262747efa54b212d16943651/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253545382e322d626c7565)](https://php.net)[![License: MIT](https://camo.githubusercontent.com/fdf2982b9f5d7489dcf44570e714e3a15fce6253e0cc6b5aa61a075aac2ff71b/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d79656c6c6f772e737667)](https://opensource.org/licenses/MIT)

Features
--------

[](#features)

- 🛒 **Flexible Cart Management**: Add, remove, and manage cart items with quantity control
- 🏷️ **Advanced Promotion System**: Support for multiple promotion types (percentage discounts, fixed amount discounts, free products, etc.)
- 💰 **Precise Decimal Calculations**: Built-in arbitrary precision decimal arithmetic using BCMath
- 🔧 **Extensible Architecture**: Easy to extend with custom items and promotions
- 📊 **Comprehensive Totals**: Detailed cart totals with promotion impacts and item subtotals
- 🎯 **Promotion Stacking**: Support for multiple promotions that can interact with each other
- 🧮 **Mathematical Functions**: Full-featured decimal class with trigonometric, logarithmic, and power functions

Installation
------------

[](#installation)

```
composer require revotale/shopping-cart
```

### Requirements

[](#requirements)

- PHP ^8.2
- BCMath extension

Quick Start
-----------

[](#quick-start)

### Basic Cart Operations

[](#basic-cart-operations)

```
