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

ActiveLibrary

stnc/shopping-cart
==================

php shopping cart class

2.1.4(5y ago)4322MITPHPPHP &gt;=5.4.0

Since Jan 29Pushed 5y ago2 watchersCompare

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

READMEChangelogDependenciesVersions (11)Used By (0)

PHP SHOPPING CART
=================

[](#php-shopping-cart)

php simple shopping cart class and html ajax example

Install
=======

[](#install)

```
composer require stnc/shopping-cart
```

---

 **SCREENSHOT**

[![](https://raw.githubusercontent.com/stnc/shopping-cart/master/screen2.png)](https://raw.githubusercontent.com/stnc/shopping-cart/master/screen2.png)

[![](https://raw.githubusercontent.com/stnc/shopping-cart/master/screen.png)](https://raw.githubusercontent.com/stnc/shopping-cart/master/screen.png)

---

init
----

[](#init)

```

        // use use \Stnc\ShoppingCart\Cart;
$cart_name = 'stnc'; // sepetin session değerine bir değer atadık
$cart = new Cart($cart_name);
$cart->groups=false;
```

ADDTOCART function
------------------

[](#addtocart-function)

add to cart

```
$data = array(
		'productID' => 100,
		'productName' => "ice cream",
		'productImageURL' => "https://example.org/icecream.jpg",
		'URL' => "https://example.org/product/100",
		'price' => 40.99,
		"totalEach" => 1,
		'stockUnit'=>'unit',
		"totalPrice" => 40.99
);
$cart->addToCart("100", $data);
	  echo '';
	  print_r($cart->getArray());
	  echo '';
```

removeCart function
-------------------

[](#removecart-function)

cart to remove

```
   $cart->removeCart(100);
	  echo '';
	  print_r($cart->getArray());
	  echo '';
```

getJson function
----------------

[](#getjson-function)

cart json info

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

viewCart function
-----------------

[](#viewcart-function)

emptyCart function
------------------

[](#emptycart-function)

cart empty

```
   $cart->emptyCart();
 	  echo '';
	  print_r($cart->getArray());
	  echo '';
```

getArray function
-----------------

[](#getarray-function)

cart to result array

```
	  echo '';
	  print_r($cart->getArray());
	  echo '';
```

```
//
 print_r( $cart->cartCount());

```

cartCount fonksiyonu
--------------------

[](#cartcount-fonksiyonu)

gives information about the total of items in the basket

```
	  print_r($cart->cartCount());
```

cartInfo fonksiyonu
-------------------

[](#cartinfo-fonksiyonu)

Cart information

```
	  print_r($cart->cartInfo());
```

```
demo page thx
https://startbootstrap.com/templates/heroic-features/

```

###  Health Score

29

—

LowBetter than 60% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity61

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

Recently: every ~14 days

Total

10

Last Release

2081d ago

Major Versions

1.4.2 → 2.0.02020-07-01

### Community

Maintainers

![](https://www.gravatar.com/avatar/c8f4a2823f892ac78ee8de4b914c5362b2410abdc53c33360adb6239f215bd06?d=identicon)[stnc](/maintainers/stnc)

---

Top Contributors

[![stnc](https://avatars.githubusercontent.com/u/3958405?v=4)](https://github.com/stnc "stnc (28 commits)")

---

Tags

phpphp-shopping-cartshopping-cartphpsessioncart

### Embed Badge

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

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

PHPackages © 2026

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