PHPackages                             atakajlo/shopping-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. atakajlo/shopping-cart

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

atakajlo/shopping-cart
======================

Framework independent cart component for your site

1.2.3(7y ago)032MITPHPPHP ^7.1

Since May 8Pushed 7y ago1 watchersCompare

[ Source](https://github.com/atakajlo/shopping-cart)[ Packagist](https://packagist.org/packages/atakajlo/shopping-cart)[ RSS](/packages/atakajlo-shopping-cart/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependencies (1)Versions (10)Used By (0)

Shopping cart
=============

[](#shopping-cart)

Framework independent cart extension. Use in project whatever you want!

[![Build Status](https://camo.githubusercontent.com/dc1043b922af4a4ed0a5341fd5b88989fd6dd5196443eab741e66e46688ac4cb/68747470733a2f2f7472617669732d63692e6f72672f6174616b616a6c6f2f73686f7070696e672d636172742e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/atakajlo/shopping-cart)[![Latest Stable Version](https://camo.githubusercontent.com/abd4b81363b29e1393cd06d514bf6958b10cf8b390b8b642de88decc0676c61f/68747470733a2f2f706f7365722e707567782e6f72672f6174616b616a6c6f2f73686f7070696e672d636172742f762f737461626c65)](https://packagist.org/packages/atakajlo/shopping-cart)[![Total Downloads](https://camo.githubusercontent.com/c2ee0be229c8560c2ec659e4ae9873c78e5313b91d493864dfb88adc08104426/68747470733a2f2f706f7365722e707567782e6f72672f6174616b616a6c6f2f73686f7070696e672d636172742f646f776e6c6f616473)](https://packagist.org/packages/atakajlo/shopping-cart)[![Latest Unstable Version](https://camo.githubusercontent.com/ae19efc4695e2a806ce9299d31de7c2988aba0ae8e0463abd26a46c93a834331/68747470733a2f2f706f7365722e707567782e6f72672f6174616b616a6c6f2f73686f7070696e672d636172742f762f756e737461626c65)](https://packagist.org/packages/atakajlo/shopping-cart)[![License](https://camo.githubusercontent.com/2ce148d36b8d9829b5c951c03111e9a9d5428921d74aa4dcabac34a3cbfadf68/68747470733a2f2f706f7365722e707567782e6f72672f6174616b616a6c6f2f73686f7070696e672d636172742f6c6963656e7365)](https://packagist.org/packages/atakajlo/shopping-cart)

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

[](#installation)

The preferred way to install this extension is through [composer](http://getcomposer.org/download/).

Either run

```
$ composer require atakajlo/shopping-cart

```

or add

```
"atakajlo/shopping-cart": "^1.2"

```

to the `require` section of your `composer.json`.

Usage
-----

[](#usage)

1. Configure cart extension

```
use atakajlo\cart\cost\calculator\SimpleCalculator;
use atakajlo\cart\Cart;
use atakajlo\cart\item\CartItem;
use atakajlo\cart\storage\SessionStorage;
use atakajlo\cart\sort\IdComparator;

$cart = new Cart(
    new SessionStorage(),
    new SimpleCalculator(),
    new IdComparator() //optional
);
```

2. Add items

```
$cartItem = new CartItem(1, 100, 1);
$cart->add($cartItem);
```

3. Update item quantity

```
$cart->changeQuantityById($cartItem->getId(), 5);
```

4. Get all items

```
$items = $cart->getItems();
```

5. Get cart total cost

```
$totalCost = $cart->getCost()->getTotal();
```

Tests
-----

[](#tests)

```
$ ./vendor/bin/phpunit

```

License
-------

[](#license)

This project is released under the terms of the MIT [license](LICENSE).

Copyright (c) 2018, Dmytry Fedorenko

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity64

Established project with proven stability

 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

9

Last Release

2882d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/5870060?v=4)[Dmytro Fedorenko](/maintainers/atakajlo)[@atakajlo](https://github.com/atakajlo)

---

Top Contributors

[![atakajlo](https://avatars.githubusercontent.com/u/5870060?v=4)](https://github.com/atakajlo "atakajlo (30 commits)")

---

Tags

cart-extensionlaravelyii2yii2-extension

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[tplaner/when

Date/Calendar recursion library.

5261.0M5](/packages/tplaner-when)[asantibanez/laravel-eloquent-state-machines

State machines for your Laravel Eloquent models

568592.8k](/packages/asantibanez-laravel-eloquent-state-machines)[watson/sitemap

Generate Google Sitemaps in Laravel

2681.3M4](/packages/watson-sitemap)[fivefilters/readability.php

A PHP port of Readability.js

311826.8k5](/packages/fivefilters-readabilityphp)[outl1ne/nova-settings

A Laravel Nova tool for editing custom settings using native Nova fields.

296883.2k3](/packages/outl1ne-nova-settings)[consoletvs/profanity

PHP library to block bad words in a string

1221.0M3](/packages/consoletvs-profanity)

PHPackages © 2026

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