PHPackages                             masterix21/laravel-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. masterix21/laravel-cart

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

masterix21/laravel-cart
=======================

Cart features for any Laravel Project

1.0.6(4y ago)08MITPHPPHP ^8.0

Since May 14Pushed 4y ago1 watchersCompare

[ Source](https://github.com/masterix21/laravel-cart)[ Packagist](https://packagist.org/packages/masterix21/laravel-cart)[ Docs](https://github.com/masterix21/laravel-cart)[ GitHub Sponsors](https://github.com/masterix21)[ RSS](/packages/masterix21-laravel-cart/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (7)Dependencies (10)Versions (8)Used By (0)

Cart integration for any Laravel Project
========================================

[](#cart-integration-for-any-laravel-project)

[![Latest Version on Packagist](https://camo.githubusercontent.com/94e6f591423c8b166333d64ff291f9e11827b5327dd5fac8cd0e2d77169dac22/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d6173746572697832312f6c61726176656c2d636172742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/masterix21/laravel-cart)[![GitHub Tests Action Status](https://camo.githubusercontent.com/869a57752bf9326d1c1a7fa6f7398676c0b7a164513aa3cc3c82d602a3d29f5a/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f6d6173746572697832312f6c61726176656c2d636172742f72756e2d74657374733f6c6162656c3d7465737473)](https://github.com/masterix21/laravel-cart/actions?query=workflow%3Arun-tests+branch%3Amaster)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/7e98df5c7ef8c67ce1f5b74e65aa7c12bc8a5c79e6c1898074c9845e77faf46e/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f6d6173746572697832312f6c61726176656c2d636172742f436865636b253230262532306669782532307374796c696e673f6c6162656c3d636f64652532307374796c65)](https://github.com/masterix21/laravel-cart/actions?query=workflow%3A%22Check+%26+fix+styling%22+branch%3Amaster)[![Total Downloads](https://camo.githubusercontent.com/22d71d84bd7f57db9737efc356ffc5577f27933ad53e3b39b095f72b10b19947/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6d6173746572697832312f6c61726176656c2d636172742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/masterix21/laravel-cart)

This is where your description should go. Limit it to a paragraph or two. Consider adding a small example.

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

[](#installation)

You can install the package via composer:

```
composer require masterix21/laravel-cart
```

You can publish and run the migrations with:

```
php artisan vendor:publish --provider="Masterix21\LaravelCart\CartServiceProvider" --tag="laravel-cart-migrations"
php artisan migrate
```

You can publish the config file with:

```
php artisan vendor:publish --provider="Masterix21\LaravelCart\CartServiceProvider" --tag="laravel-cart-config"
```

Usage
-----

[](#usage)

```
$product = YourProductModel::first();

//
// Add a product to cart
$cartItem = Cart::add(label: $product->name, item: $product, price: $product->price, quantity: 1);

//
// Change the cart item quantity
Cart::set($cartItem, 2); // or
$cartItem->setQuantity(2);

//
// Increase the cart item quantity
Cart::increase($cartItem); // to increase of 1
Cart::increase($cartItem, 5); // to increase of 5
$cartItem->increase(); // to increase of 1
$cartItem->increase(5); // to increase of 5

//
// Decrease the cart item quantity, and if the
// quantity is zero, removes the item from the cart.
Cart::decrease($cartItem); // to decrease of 1
Cart::decrease($cartItem, 5); // to decrease of 5
$cartItem->decrease(); // to decrease of 1
$cartItem->decrease(5); // to decrease of 5

// Retrieve all cart items
$items = Cart::items();

// Clear the cart
Cart::clear();
```

Views using Blade
-----------------

[](#views-using-blade)

Display the cart items counter that will auto-refresh on cart changes:

```

```

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](.github/CONTRIBUTING.md) for details.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [Luca Longo](https://github.com/masterix21)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity61

Established project with proven stability

 Bus Factor1

Top contributor holds 87.2% 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 ~4 days

Total

7

Last Release

1801d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/177020fc4adb5c08acee3e6fe0b65002a96665c5d5c522a3ef009b4105fd634f?d=identicon)[masterix](/maintainers/masterix)

---

Top Contributors

[![masterix21](https://avatars.githubusercontent.com/u/6555012?v=4)](https://github.com/masterix21 "masterix21 (34 commits)")[![mikugrunge](https://avatars.githubusercontent.com/u/44170111?v=4)](https://github.com/mikugrunge "mikugrunge (5 commits)")

---

Tags

laravelcartmasterix21

###  Code Quality

TestsPHPUnit

Static AnalysisPsalm

Type Coverage Yes

### Embed Badge

![Health badge](/badges/masterix21-laravel-cart/health.svg)

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

###  Alternatives

[spatie/laravel-data

Create unified resources and data transfer objects

1.7k28.9M627](/packages/spatie-laravel-data)[hirethunk/verbs

An event sourcing package that feels nice.

513162.9k6](/packages/hirethunk-verbs)[worksome/exchange

Check Exchange Rates for any currency in Laravel.

123544.7k](/packages/worksome-exchange)[ralphjsmit/livewire-urls

Get the previous and current url in Livewire.

82270.3k4](/packages/ralphjsmit-livewire-urls)[hydrat/filament-table-layout-toggle

Filament plugin adding a toggle button to tables, allowing user to switch between Grid and Table layouts.

6292.3k1](/packages/hydrat-filament-table-layout-toggle)[ralphjsmit/laravel-helpers

A package containing handy helpers for your Laravel-application.

13704.6k2](/packages/ralphjsmit-laravel-helpers)

PHPackages © 2026

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