PHPackages                             dcblogdev/phpcart - 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. dcblogdev/phpcart

ActiveLibrary

dcblogdev/phpcart
=================

Simple framework agnostic shopping cart

v1.0.3(3y ago)6154↓100%2MITPHPPHP ^7.3|^8.0

Since Jul 16Pushed 3y ago1 watchersCompare

[ Source](https://github.com/dcblogdev/phpcart)[ Packagist](https://packagist.org/packages/dcblogdev/phpcart)[ Docs](https://github.com/dcblogdev/phpcart)[ RSS](/packages/dcblogdev-phpcart/feed)WikiDiscussions master Synced today

READMEChangelog (4)Dependencies (2)Versions (5)Used By (0)

PHPCart
=======

[](#phpcart)

Simple framework agnostic shopping cart.

Originally from  I've released this under my own namespace as I needed support for Laravel 7/8, at the time of writing this there is an open PR on the original repo which has not been responded to.

Features
--------

[](#features)

- Simple API
- Support multiple cart instances
- Framework agnostic

Requirements
------------

[](#requirements)

- PHP 7.3+

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

[](#installation)

PHPCart is available via Composer

```
$ composer require dcblogdev/phpcart
```

Usage
-----

[](#usage)

### Add Item

[](#add-item)

The add method required `id`, `name`, `price` and `quantity` keys. However, you can pass any data that your application required.

```
use Dcblogdev\Phpcart\Cart;

$cart = new Cart();

$cart->add([
    'id'       => 1001,
    'name'     => 'Skinny Jeans',
    'quantity' => 1,
    'price'    => 90
]);
```

### Update Item

[](#update-item)

```
$cart->update([
    'id'       => 1001,
    'name'     => 'Hoodie'
]);
```

### Update quantity

[](#update-quantity)

```
$cart->updateQty(1001, 3);
```

### Update price

[](#update-price)

```
$cart->updatePrice(1001, 30);
```

### Remove an Item

[](#remove-an-item)

```
$cart->remove(1001);
```

### Get all Items

[](#get-all-items)

```
$cart->getItems();
// or
$cart->items();
```

### Get an Item

[](#get-an-item)

```
$cart->get(1001);
```

### Determining if an Item exists in the cart

[](#determining-if-an-item-exists-in-the-cart)

```
$cart->has(1001);
```

### Get the total number of items in the cart

[](#get-the-total-number-of-items-in-the-cart)

```
$cart->count();
```

### Get the total quantities of items in the cart

[](#get-the-total-quantities-of-items-in-the-cart)

```
$cart->totalQuantity();
```

### Total sum

[](#total-sum)

```
$cart->getTotal();
```

### Empty the cart

[](#empty-the-cart)

```
$cart->clear();
```

### Multiple carts

[](#multiple-carts)

PHPCart supports multiple cart instances, so that you can have as many shopping cart instances on the same page as you want without any conflicts.

```
$cart = new Cart('cart1');
// or
$cart->setCart('cart2');
$cart->add([
    'id'       => 1001,
    'name'     => 'Skinny Jeans',
    'quantity' => 1,
    'price'    => 90
]);

//or
$cart->named('cart3')->add([
    'id'       => 1001,
    'name'     => 'Jeans',
    'quantity' => 2,
    'price'    => 100
]);
```

###  Health Score

30

—

LowBetter than 67% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity17

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 85.7% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~311 days

Total

4

Last Release

1143d ago

PHP version history (3 changes)v1.0.0PHP &gt;=7.2

v1.0.1PHP &gt;=7.3

v1.0.2PHP ^7.3|^8.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/39399156?v=4)[dcblog](/maintainers/dcblog)[@dcblog](https://github.com/dcblog)

---

Top Contributors

[![dcblogdev](https://avatars.githubusercontent.com/u/1018170?v=4)](https://github.com/dcblogdev "dcblogdev (6 commits)")[![thursdaydan](https://avatars.githubusercontent.com/u/8914312?v=4)](https://github.com/thursdaydan "thursdaydan (1 commits)")

---

Tags

cartshopping cartLaravel shopping cartLaravel cartphp cart

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/dcblogdev-phpcart/health.svg)

```
[![Health](https://phpackages.com/badges/dcblogdev-phpcart/health.svg)](https://phpackages.com/packages/dcblogdev-phpcart)
```

###  Alternatives

[anam/phpcart

Simple framework agnostic shopping cart

12215.4k](/packages/anam-phpcart)[darryldecode/cart

Laravel 5 Shopping cart

1.4k1.7M7](/packages/darryldecode-cart)[binafy/laravel-cart

Laravel Cart is a customizable package for adding shopping cart functionality to Laravel applications

40541.8k](/packages/binafy-laravel-cart)[lukepolo/laracart

A simple cart for Laravel

585128.7k1](/packages/lukepolo-laracart)[amsgames/laravel-shop

Package set to provide shop or e-commerce functionality (such as CART, ORDERS, TRANSACTIONS and ITEMS) to Laravel for customizable builds.

4845.9k](/packages/amsgames-laravel-shop)[realrashid/cart

Meet Cart — your ultimate solution for seamless shopping cart functionality in Laravel applications. Cart simplifies the complexities of shopping cart operations, from product additions to total calculations, ensuring a frictionless user experience.

1093.3k](/packages/realrashid-cart)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
