Price calculator library
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";
}
-
v1.0.1 Released version 1.0.1
Fixed
PriceCalculator
andIPriceCalculator
return types in methodgetDiscount()
andgetDecimalPoints()
. -
v1.0.0 Released version 1.0.0
After long use in production, version
1.0.0
is here with few updates:- Updated minimal
nette/bootstrap
version to2.4.5
- Allow installing with
nette/utils
andnette/bootstrap
version3.0
- Added scalar typehints for property and return types
- Updated code to use new PHP features
- Add
declare(strict_types=1)
to all PHP files - Fixed compatibility with PHP 7.2 and 7.3
- Fixed return type declaration
- Fixed coding style, added
EasyCodingStandard
for automated checks
- Updated minimal
-
v0.4.0 Released version 0.4.0
- Dropped HHVM, PHP 5.6 and 7.0 support
- Deprecated
Nette\Object
switched toNette\SmartObject
trait - Upgraded
nette/utils
to version2.5
- Added PHP 7.2 support
-
v0.3.0 Released version 0.3.0
- Fixed compatibility with Nette 2.4
- Dropped php 5.4 and 5.5 support
-
v0.2.0 Released version 0.2.0
- Added Extension for Nette framework
- Improved coding style
- Renamed reduction to discount [BC Break]
- Added separated discount class implementations [BC Break]
-
v0.1.0 Released version 0.1.0
First release.