PHPackages                             unodepiera/phalcon\_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. unodepiera/phalcon\_cart

ActiveLibrary[Framework](/categories/framework)

unodepiera/phalcon\_cart
========================

A shopping cart that allows multiple instances to work with PHP Phalcon

171669[1 issues](https://github.com/uno-de-piera/phalcon_cart/issues)[1 PRs](https://github.com/uno-de-piera/phalcon_cart/pulls)PHP

Since Apr 21Pushed 5y ago2 watchersCompare

[ Source](https://github.com/uno-de-piera/phalcon_cart)[ Packagist](https://packagist.org/packages/unodepiera/phalcon_cart)[ RSS](/packages/unodepiera-phalcon-cart/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

Complet cart system for Phalcon
===============================

[](#complet-cart-system-for-phalcon)

Phalcon cart provides complet cart system, allows you to create multiple instances to have all the areas we want independently.

If ocurred any problem with proccess cart, the class store logs into app/logs/shoppingCart.log for more info.

Cart works with Phalcon sessions, if you would, you can use adapter sessions for manage cart with database, more info.

- [Incubator Link](https://github.com/phalcon/incubator/blob/master/README.md#installing-via-github)
- [Phalcon Sesion Adapter](https://github.com/phalcon/incubator/tree/master/Library/Phalcon/Session/Adapter#phalconsessionadapter)
- [Show demo](http://phalcon-tuts.com/phalconShop)

Installation with Composer
==========================

[](#installation-with-composer)

Create a new file composer.json, open and add the next code

```json { "require": { "unodepiera/phalcon\_cart": "dev-master" }, "minimum-stability": "dev" } ``` Update your packages with composer update or install with composer install.

Now open app/config/loader.php and replace the code.

```php ```
$loader = new \Phalcon\Loader();

/**
 * We're a registering a set of directories taken from the configuration file
 */
$loader->registerDirs(
	array(
		$config->application->controllersDir,
		$config->application->modelsDir,
		$config->application->libraryDir
	)
);

//register the new class ShoppingCart
$loader->registerClasses(
    array(
        "ShoppingCart"         => "../vendor/unodepiera/phalcon_cart/ShoppingCart.php",
    )
);

$loader->register();

```

```

Installation without Composer

Download file ShoppingCart.php and create a new directory library in app dir.
Save file into library dir and open app/config/loader.php, now update this file.

```php
	$loader = new \Phalcon\Loader();

	/**
	 * We're a registering a set of directories taken from the configuration file
	 */
	$loader->registerDirs(
		array(
			$config->application->controllersDir,
			$config->application->modelsDir,
			$config->application->libraryDir//register dir library dir
		)
	);

	$loader->register();

```

Example Usage Phalcon Cart
==========================

[](#example-usage-phalcon-cart)

First create a new instance
---------------------------

[](#first-create-a-new-instance)

```php $this-&gt;cart = new ShoppingCart("myShop"); ``` Insert simple product
---------------------

[](#insert-simple-product)

```php $product = array( "id" =&gt; 3, "name" =&gt; "Pasta de dientes", "price" =&gt; 1.80, "qty" =&gt; 2, "description" =&gt; "Pasta de dientes......" ); ```
if($this->cart->add($product) != false)
{
	echo "";
	var_dump($this->cart->getContent());
}

```

```
Insert multiple products
```php
	$products = array(
		array(
			"id"			=>		1,
			"name"			=>		"Almendras",
			"price"			=>		2.5,
			"qty"			=>		8,
			"description"	=>		"Almendras saladas"
		),
		array(
			"id"			=>		2,
			"name"			=>		"Galletas pou",
			"price"			=>		2.7,
			"qty"			=>		5,
			"description"	=>		"Galletas del amigo pou"
		),
		array(
			"id"			=>		3,
			"name"			=>		"Pasta de dientes",
			"price"			=>		1.80,
			"qty"			=>		8,
			"description"	=>		"Pasta de dientes......"
		)
	);

	if($this->cart->addMulti($products) != false)
	{
		echo "";
		var_dump($this->cart->getContent());
	}

```

Update one product
------------------

[](#update-one-product)

```php $product = array( "id" =&gt; 3, "name" =&gt; "Pasta de dientes", "price" =&gt; 1.80, "qty" =&gt; 12, "description" =&gt; "Pasta de dientes......" ); ```
if($this->cart->update($product) != false)
{
	echo "";
	var_dump($this->cart->getContent());
}

```

```
Update multiple products
```php
	$products = array(
		array(
			"id"			=>		1,
			"name"			=>		"Almendras",
			"price"			=>		2.5,
			"qty"			=>		1,
			"description"	=>		"Almendras saladas"
		),
		array(
			"id"			=>		2,
			"name"			=>		"Galletas pou",
			"price"			=>		2.7,
			"qty"			=>		1,
			"description"	=>		"Galletas del amigo pou"
		),
		array(
			"id"			=>		3,
			"name"			=>		"Pasta de dientes",
			"price"			=>		1.80,
			"qty"			=>		1,
			"description"	=>		"Pasta de dientes......"
		)
	);

	if($this->cart->updateMulti($products) != false)
	{
		echo "";
		var_dump($this->cart->getContent());
	}

```

Check and print options
-----------------------

[](#check-and-print-options)

Check if product has options and print, need his rowId

```php if($this-&gt;cart-&gt;hasOptions("0e043c0cd48de80fa4f6ed23a15d6d10") != false) { echo "```
";
		var_dump($this->cart->getOptions("0e043c0cd48de80fa4f6ed23a15d6d10"));
	}
```
Get total price cart
```php
	echo $this->cart->getTotal();
```
Get total items cart
```php
	echo $this->cart->getTotalItems();
```
Remove a product
You just need to pass a rowid that there
```php
	if($this->cart->removeProduct("0e043c0cd48de80fa4f6ed23a15d6d10") != false)
	{
		echo "";
		var_dump($this->cart->getContent());
	}
```
Remove a cart
You just need that there
```php
	if($this->cart->destroy() != false)
	{
		echo "";
		var_dump($this->cart->getContent());
	}
```
Get cart content
```php
	var_dump($this->cart->getContent());
```
Visit me
```

- [Visit me](http://uno-de-piera.com)
- [Phalcon Cart on Packagist](https://packagist.org/packages/unodepiera/phalcon_cart)
- [License](http://www.opensource.org/licenses/mit-license.php)

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity22

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity41

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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/869a644a1fba01392533fea7c25eadde27caa339a7b6cd71e4e4ef18f2351f49?d=identicon)[unodepiera](/maintainers/unodepiera)

---

Top Contributors

[![israel981](https://avatars.githubusercontent.com/u/8269286?v=4)](https://github.com/israel981 "israel981 (12 commits)")

### Embed Badge

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

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

###  Alternatives

[laravel/telescope

An elegant debug assistant for the Laravel framework.

5.2k67.8M192](/packages/laravel-telescope)[spiral/roadrunner

RoadRunner: High-performance PHP application server and process manager written in Go and powered with plugins

8.4k12.2M84](/packages/spiral-roadrunner)[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.

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

A simple API extension for DateTime.

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

PHPackages © 2026

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