PHPackages                             shortcutmediaro/yii2-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. shortcutmediaro/yii2-cart

ActiveYii2-extension[Framework](/categories/framework)

shortcutmediaro/yii2-cart
=========================

Yii2 Shopping cart

1.0(11y ago)012PHPPHP &gt;=5.4.0

Since May 6Pushed 11y ago1 watchersCompare

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

READMEChangelog (1)DependenciesVersions (2)Used By (0)

Shopping cart extension for Yii2
================================

[](#shopping-cart-extension-for-yii2)

@todo: upgrade readme

### Using the shopping cart

[](#using-the-shopping-cart)

Operations with the shopping cart are very straightforward when using a models that implement one of the two cart interfaces. The cart object can be accessed under `\Yii::$app->cart` and can be overridden in configuration if you need to customize it.

```
// access the cart from "cart" subcomponent
$cart = \Yii::$app->cart;

// Product is an AR model implementing CartProductInterface
$product = Product::find(1);

// add an item to the cart
$cart->add($product);

// returns the sum of all 'vat' attributes (or return values of getVat()) from all models in the cart.
$totalVat = $cart->getAttributeTotal('vat');

// clear the cart
$cart->clear();

// render the contents of the cart with default parameters
echo \yii2mod\cart\widgets\CartGrid::widget();
```

#### Items in the cart

[](#items-in-the-cart)

Products/items that are added to the cart are serialized/unserialized when saving and loading data from cart storage. If you are using Active Record models as products/discounts, make sure that you are omitting any unnecessary references from the serialized data to keep it compact.

```
// get all items from the cart
$items = $cart->getItems();

// get only products
$items = $cart->getItems(Cart::ITEM_PRODUCT);

// loop through cart items
foreach ($items as $item) {
	// access any attribute/method from the model
	var_dump($item->getAttributes());

	// remove an item from the cart by its ID
	$cart->remove($item->uniqueId)
}
```

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

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

4031d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/2df51d506972d673ed415efd7bb88a50643b3df0bd558a35a7cf39e743ae7c05?d=identicon)[shortcutmediaro](/maintainers/shortcutmediaro)

---

Top Contributors

[![shortcutmediaro](https://avatars.githubusercontent.com/u/10462596?v=4)](https://github.com/shortcutmediaro "shortcutmediaro (8 commits)")[![dmitry-semenov](https://avatars.githubusercontent.com/u/17027799?v=4)](https://github.com/dmitry-semenov "dmitry-semenov (6 commits)")[![scrutinizer-auto-fixer](https://avatars.githubusercontent.com/u/6253494?v=4)](https://github.com/scrutinizer-auto-fixer "scrutinizer-auto-fixer (1 commits)")

### Embed Badge

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

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

###  Alternatives

[laravel/passport

Laravel Passport provides OAuth2 server support to Laravel.

3.4k85.0M532](/packages/laravel-passport)[nolimits4web/swiper

Most modern mobile touch slider and framework with hardware accelerated transitions

41.8k177.2k1](/packages/nolimits4web-swiper)[laravel/dusk

Laravel Dusk provides simple end-to-end testing and browser automation.

1.9k36.7M259](/packages/laravel-dusk)[laravel/prompts

Add beautiful and user-friendly forms to your command-line applications.

712181.8M596](/packages/laravel-prompts)[cakephp/chronos

A simple API extension for DateTime.

1.4k47.7M121](/packages/cakephp-chronos)[laravel/pail

Easily delve into your Laravel application's log files directly from the command line.

91545.3M590](/packages/laravel-pail)

PHPackages © 2026

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