Download the PHP package treehousetim/shopcart without Composer
On this page you can find all versions of the php package treehousetim/shopcart. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download treehousetim/shopcart
More information about treehousetim/shopcart
Files in treehousetim/shopcart
Package shopcart
Short Description A simple, zero-dependency, zero UI, Shopping Cart library.
License MIT
Informations about the package shopcart
shopCart
Shopping Cart Core Functionality PHP Library
Installing
composer require treehousetim/shopcart
Interfaces and Abstract Classes
In order to use the shopCart, you will need to instantiate both a treehousetim\shopCart\cart
and a treehousetim\shopCart\catalog
object.
The constructor for the cart requires a catalog object be passed.
In order for a catalog object to function, it requires a product loader be implemented that implements catalogLoaderInterface
catalogLoaderInterface
A catalog object is used to load products into the product catalog.
cartStorageInterface
You can use a lot of different storage options for a cart. treehousetim\shopCart
provides an implementation for session storage.
After creating your implementation of this interface, you must supply it to your cart using $cart->setStorageHandler( $storageHandler );
catalogTotalTypeLoaderInterface
You must implement a class that conforms to this interface to support different types of product totals. Typical e-commerce shop carts will probably only need a single catalogTotalType for price, but there are other businesses that need totals of different product properties.
Here is a sample catalogTotalTypeLoaderInterface implementation for both price and some special case of "points"
totalFormatterInterface
Testing
If you have cloned this repo, you can run the tests (there are none yet). There are no dependencies, but PHPUnit is installed with composer.
composer install
./vendor/bin/phpunit --bootstrap vendor/autoload.php test