Download the PHP package koind/multi-basket without Composer
On this page you can find all versions of the php package koind/multi-basket. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download koind/multi-basket
More information about koind/multi-basket
Files in koind/multi-basket
Package multi-basket
Short Description A universal component of the basket that can be used in any php framework.
License MIT
Informations about the package multi-basket
Multi-basket
A universal component of the basket that can be used in any php framework.
Installation
Run the following command from you terminal:
or add this to require section in your composer.json file:
then run
Usage
First, you need to plug the required classes and initialized this classes. Next, create an instance of the Cart class by passing the appropriate arguments. Congratulations You can use the functionality of the basket.
Available Methods
The following methods are available:
koind\Cart
koind\CartItem
koind\cost\CalculatorInterface
This interface implements all types of classes necessary for discounts.
koind\storage\StorageInterface
This interface implements all types of classes required for data storage.
Example usage class Cart
Get all products from the cart:
Add a new product to your cart:
Changing the quantity of product:
Get the total cost of goods, including all discounts:
Remove product from cart:
Clear cart:
Different storages
An example of a storage implementation for different frameworks.
koind\storage\LaravelSessionStorage - for Laravel
koind\storage\SymfonySessionStorage - for Symfony
koind\storage\YiiSessionStorage - for Yii
If you need a component for another framework, you can easily implement the interface
Tests
Run the following command from you terminal: