PHPackages                             noahenrik/cart2go - 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. noahenrik/cart2go

ActiveLibrary

noahenrik/cart2go
=================

A simple shopping cart.

v0.1(5y ago)15PHP

Since Aug 4Pushed 5y ago1 watchersCompare

[ Source](https://github.com/jasttestin/cart2go)[ Packagist](https://packagist.org/packages/noahenrik/cart2go)[ RSS](/packages/noahenrik-cart2go/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (4)Used By (0)

cart2go
=======

[](#cart2go)

This is a simple cart system made for PHP that will allow you to save item IDs to add to your cart. Saving prices is risky and should always be checked in the back-end.

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

[](#installation)

Use composer to install cart2go.

```
composer require noahenrik/cart2go

```

Make sure to update your autoloader. For composer:

```
composer dump-autoload

```

Usage
-----

[](#usage)

Import the namespace with class:

```
$cart = new \Cart\Cart();
```

### Add items to cart:

[](#add-items-to-cart)

The `addItemToCart` method takes 2 paramaters, itemId and $amount. **Amount is an optional paramater**.

If the user clicks on an item that's already in the cart, the amount will automatically be incremented by 1.

If you specify an amount, the existing amount will be updated to the amount given and not incremented by 1.

```
$cart->addItemToCart($itemId, $amount);

//OR

$cart->addItemToCart($itemId);
```

### Grab all items currently in the cart:

[](#grab-all-items-currently-in-the-cart)

This method will grab all the items currently in the cart.

```
$allCartItems = $cart->grabAllItems();
```

#### Example

[](#example)

```
$allCartItems = $cart->grabAllItems();

foreach ($allCartItems as $key => $cartItem) {

  echo "Amount: " . $allCartItems[$key]['amount'] . " ItemId: " . $allCartItems[$key]['itemId'];
}
```

### Reset a cart:

[](#reset-a-cart)

This will remove all items within the cart.

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

### Grab single item:

[](#grab-single-item)

This will grab only the selected item from the cart.

```
$cart->grabItem($itemId);
```

### Remove item from cart:

[](#remove-item-from-cart)

This will remove a selected item from the cart.

```
$cart->removeItem($itemId);
```

License
-------

[](#license)

[GNU Affero General Public License v3.0](https://www.gnu.org/licenses/agpl-3.0.en.html)

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity47

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 52.9% 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

Unknown

Total

1

Last Release

2104d ago

### Community

Maintainers

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

---

Top Contributors

[![Noah-Xendd](https://avatars.githubusercontent.com/u/98832523?v=4)](https://github.com/Noah-Xendd "Noah-Xendd (9 commits)")[![jasttestin](https://avatars.githubusercontent.com/u/56484276?v=4)](https://github.com/jasttestin "jasttestin (8 commits)")

### Embed Badge

![Health badge](/badges/noahenrik-cart2go/health.svg)

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

PHPackages © 2026

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