PHPackages                             miladev/lara-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. miladev/lara-cart

ActiveLibrary

miladev/lara-cart
=================

Laravel shopping cart

1.3(2y ago)1481MITPHPPHP &gt;=8.0

Since Aug 9Pushed 2y ago1 watchersCompare

[ Source](https://github.com/miladev95/laracart)[ Packagist](https://packagist.org/packages/miladev/lara-cart)[ Docs](https://github.com/miladev95/lara-cart)[ RSS](/packages/miladev-lara-cart/feed)WikiDiscussions master Synced 4w ago

READMEChangelog (4)DependenciesVersions (5)Used By (0)

Lara-PHPCart
============

[](#lara-phpcart)

Laravel PHP shopping cart

[![Latest Stable Version](https://camo.githubusercontent.com/d413c0100b81c7263036c03ec0aeab82365d7c8b1de7f283526b8e5c68677e2f/68747470733a2f2f706f7365722e707567782e6f72672f6d696c616465762f6c6172612d6d6574612f76)](//packagist.org/packages/miladev/lara-cart)[![License](https://camo.githubusercontent.com/e2b43e99efaa2d7d70697bde43908261ba7a0743e50d7c86a1f083b72c831ccf/68747470733a2f2f706f7365722e707567782e6f72672f6d696c616465762f6c6172612d6d6574612f6c6963656e7365)](//packagist.org/packages/miladev/lara-cart)[![Total Downloads](https://camo.githubusercontent.com/5341284c3bf932b1dba3c65888aae4ec08899c30fd30e4bac9c10f5d044462b7/68747470733a2f2f706f7365722e707567782e6f72672f6d696c616465762f6c6172612d6d6574612f646f776e6c6f616473)](//packagist.org/packages/miladev/lara-cart)

[![](https://camo.githubusercontent.com/d6ee11871bfe8c58e28e4c6ed67dfc79eabda39795ba5df8316232094ee34876/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6973737565732f6d696c6164657639352f6c617261636172742e737667)](https://github.com/miladev95/laracart/issues)[![](https://camo.githubusercontent.com/7dd27b2c87747b7af318e1ec91b7e011a642fd879d3633c718ad6e1872099a48/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73746172732f6d696c6164657639352f6c617261636172742e737667)](https://github.com/miladev95/laracart/stargazers)[![](https://camo.githubusercontent.com/f90888c71416c7400a9846ea706df9ab4444727d9df41f92cddababec9606686/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f666f726b732f6d696c6164657639352f6c617261636172742e737667)](https://github.com/miladev95/laracart/network)

Features
--------

[](#features)

- Simple API
- Support multiple cart instances

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

[](#requirements)

- Laravel 5+

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

[](#installation)

Lara-phpcart is available via Composer

```
$ composer require miladev/lara-cart
```

You can now use this facade in place of instantiating the Cart yourself in the following examples.

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 Miladev\Laracart\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)

Lara-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

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~22 days

Total

3

Last Release

959d ago

PHP version history (2 changes)1.0PHP &gt;=5.4.0

1.2PHP &gt;=8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/804b53db0aff0c136bb3b1ead2f1d660ef00e4ce1650aa49e6edf0fc2338921c?d=identicon)[miladev95](/maintainers/miladev95)

---

Top Contributors

[![miladev95](https://avatars.githubusercontent.com/u/35612406?v=4)](https://github.com/miladev95 "miladev95 (21 commits)")

---

Tags

cartshopping cartLaravel shopping cartLaravel cartLaravel php cart

### Embed Badge

![Health badge](/badges/miladev-lara-cart/health.svg)

```
[![Health](https://phpackages.com/badges/miladev-lara-cart/health.svg)](https://phpackages.com/packages/miladev-lara-cart)
```

###  Alternatives

[darryldecode/cart

Laravel 5 Shopping cart

1.4k1.7M7](/packages/darryldecode-cart)[anam/phpcart

Simple framework agnostic shopping cart

12115.4k](/packages/anam-phpcart)[binafy/laravel-cart

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

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

A simple cart for Laravel

583135.4k1](/packages/lukepolo-laracart)[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.6k](/packages/realrashid-cart)[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)

PHPackages © 2026

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