sunfoxcz/price-calculator

Library for easier price calculation using VAT and discount.

v1.0.1 2019-03-22 10:18 UTC

README

Build Status Code Coverage Scrutinizer Code Quality

Library for easier price calculation using VAT and discount.

Installation

composer require sunfoxcz/price-calculator:@dev

Usage

<?php declare(strict_types=1);

use Sunfox\PriceCalculator\Discount\PercentDiscount;
use Sunfox\PriceCalculator\PriceCalculator;

$calc = (new PriceCalculator)
	->setBasePrice(1983.48)
	->setDiscount(new PercentDiscount(10))
	->setVatRate(21);

foreach ($calc->calculate()->toArray() as $k => $v) {
	echo "{$k}: {$v}\n";
}