Skip to content
This repository has been archived by the owner on Sep 27, 2019. It is now read-only.

faustbrian-archives/Basket

Repository files navigation

Basket

Build Status PHP from Packagist Latest Version License

This package is based on Basket by philipbrown.

Installation

Require this package, with Composer, in the root directory of your project.

$ composer require faustbrian/basket

Coupons

Important: Coupons are applied AFTER Discounts! This means if you have applied a Discount and a Coupon the Coupon will be applied to the discounted price.

Usage

For usage instructions check the USAGE.md.

Create a coupon

$coupon = new Coupon('COUPON_NAME');
$coupon->add(new PercentageDiscount(20));
$coupon->add(new ValueDiscount(new Money(500, new Currency('GBP'))));

Apply a coupon

$basket->products()->first()->coupon($coupon);

Serialize a coupon - Could be used when the coupon needs to be stored.

$coupon->serialize();

Quantity Discount

Grant 20% discount on each Product if more than 5 are purchased

$quantityDiscount = new PercentageDiscount(20);
$coupon->add(new QuantityDiscount(5, $quantityDiscount));

Grant 5£ discount on each Product if more than 5 are purchased

$quantityDiscount = new ValueDiscount(new Money(500, new Currency('GBP')));
$coupon->add(new QuantityDiscount(5, $quantityDiscount));

Testing

$ phpunit

Security

If you discover a security vulnerability within this package, please send an e-mail to hello@basecode.sh. All security vulnerabilities will be promptly addressed.

Credits

License

MIT © Brian Faust

About

The missing link between your product pages and your payment gateway.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages