Statistics
2864
2
0
153d
Badges
Dependencies

Price calculator library

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";
}
  • v1.0.1 Released version 1.0.1

    Fixed PriceCalculator and IPriceCalculator return types in method getDiscount() and getDecimalPoints().

  • 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 to 2.4.5
    • Allow installing with nette/utils and nette/bootstrap version 3.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
  • v0.4.0 Released version 0.4.0

    • Dropped HHVM, PHP 5.6 and 7.0 support
    • Deprecated Nette\Object switched to Nette\SmartObject trait
    • Upgraded nette/utils to version 2.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.

Is this addon outdated? Did you find an issue? Please report it.

Componette Componette admin@componette.com