PHPackages                             girover/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. [Framework](/categories/framework)
4. /
5. girover/cart

ActiveLibrary[Framework](/categories/framework)

girover/cart
============

shopping cart package for laravel

v0.1.2-alpha(3y ago)011MITPHPPHP ^8.0

Since Jul 10Pushed 3y ago1 watchersCompare

[ Source](https://github.com/girover/cart)[ Packagist](https://packagist.org/packages/girover/cart)[ Docs](https://github.com/girover/cart)[ RSS](/packages/girover-cart/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (3)Dependencies (8)Versions (4)Used By (0)

Shopping Cart Package
=====================

[](#shopping-cart-package)

[![Latest Version on Packagist](https://camo.githubusercontent.com/00dd970b2247dcc796df2e8c47e06d073f95707e3dfb8798eaae099342dbcf1f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6769726f7665722f636172742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/girover/cart)[![GitHub Tests Action Status](https://camo.githubusercontent.com/ecbb34c0b15f9a8c9bd1a3f2050fe061faa33a1b4981217e51da353d877d1440/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f6769726f7665722f636172742f72756e2d74657374733f6c6162656c3d7465737473)](https://github.com/girover/cart/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/e2ab4a032401d0e26dcac875a0aba05759c2e72de9c56d1926995359d40c63ae/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f6769726f7665722f636172742f436865636b253230262532306669782532307374796c696e673f6c6162656c3d636f64652532307374796c65)](https://github.com/girover/cart/actions?query=workflow%3A%22Check+%26+fix+styling%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/f85c4ae827f26eb76df29000a8abe23b9fe26ca13bd365dc83e01a5e8c99c577/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6769726f7665722f636172742e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/girover/cart)

---

Content
-------

[](#content)

- [Introduction](#introduction)
- [Prerequisites](#prerequisites)
- [Installation](#installation)
- [Configuration](#configuration)
- [Usage](#usage)
    - [Authenticated User](#authenticated-user)
    - [Session User](#session-user)
- [Testing](#testing)
- [Changelog](#changelog)
- [Contributing](#contributing)
- [Security Vulnerabilities](#security-vulnerabilities)
- [Credits](#credits)
- [License](#license)

Introduction
------------

[](#introduction)

**girover/cart** is a package for e-commerce websites to deal with shopping car.

Prerequisites
-------------

[](#prerequisites)

- Laravel 8+
- PHP 8+
- Mysql 5.7+

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

[](#installation)

You can add the package via **composer**:

```
composer require girover/cart
```

Before installing the package you should configure your database.

Then you can install the package by running Artisan command

```
php artisan cart:install
```

this command will take care of the following tasks:

- Publishing Config file `config\cart.php` to the config folder of your Laravel application.
- Publishing migration files to folder `Database\migrations` in your application.
- Migrate the published migrations.

Configuration
-------------

[](#configuration)

`girover/cart` offers two ways to use the cart in your application.

- Authenticated User using database driver for storing cart data.
- Session driver to store cart data in session.

To specify which way you should use, you can add a driver to `config/cart.php` file

```
    return [
        'driver' => 'database',
        //'driver' => 'session',
    ]
```

When setting driver to `database`, the cart data will be stored in database table `carts`. And users should be authenticated to access cart functionality.
When setting driver to `session`, no database is used and data will be stored in session. In addition no authenticated users are required to access cart functionality.

In database cart your `User` model must use trait `Girover\Cart\Concerns\HasCart`.

Usage
-----

[](#usage)

To start using the cart, you can use the global helper function `shopping_cart`.
So you can this function to add items, remove, increase quantities or decrease.

```
   // CartController

   shopping_cart()->add(['id'=>'1', 'name'=>'Iphone 13', 'price'=>1000], 'id');
```

Notice that the second argument takes an attribute's name to make sure that items are associated with a specific key, which makes it easier for counting and processing items. If you choose `name` for example, so every time you add new item with name `Iphone 13` to the cart then only quantity and total price of this item will be changed.

You can also pass a model as first parameter to the cart's `add` method.

```
    use App\Models\Product;

    $product = Product::find(1);

    shopping_cart()->add($product, $product->id);
```

To increase quantity of specific item in the cart, you can use the method `increaseItemQuantity($key)`

```
    $product = Product::find(1);
    shopping_cart()->increaseItemQuantity($product->id);
```

Testing
-------

[](#testing)

Changelog
---------

[](#changelog)

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

[](#security-vulnerabilities)

Credits
-------

[](#credits)

License
-------

[](#license)

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity40

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 ~6 days

Total

3

Last Release

1395d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/965c06cf8c6495d548d76f9925467bdb75396d31e17a03fba90693bf65d22438?d=identicon)[girover](/maintainers/girover)

---

Top Contributors

[![girover](https://avatars.githubusercontent.com/u/53403538?v=4)](https://github.com/girover "girover (15 commits)")

---

Tags

laravelcartgirover

###  Code Quality

TestsPHPUnit

Static AnalysisPsalm

Type Coverage Yes

### Embed Badge

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

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

###  Alternatives

[laravel/horizon

Dashboard and code-driven configuration for Laravel queues.

4.2k84.2M225](/packages/laravel-horizon)[lunarstorm/laravel-ddd

A Laravel toolkit for Domain Driven Design patterns

17959.0k](/packages/lunarstorm-laravel-ddd)[bezhansalleh/filament-plugin-essentials

A collection of essential traits that streamline Filament plugin development by taking care of the boilerplate, so you can focus on shipping real features faster

27584.7k16](/packages/bezhansalleh-filament-plugin-essentials)[vormkracht10/laravel-mails

Laravel Mails can collect everything you might want to track about the mails that has been sent by your Laravel app.

24149.7k](/packages/vormkracht10-laravel-mails)[jonpurvis/squeaky

A Laravel Validation Rule to Help Catch Profanity.

706.0k](/packages/jonpurvis-squeaky)

PHPackages © 2026

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