# PHP Price Calculator: Calculate prices using arbitrary precision math

 Info Example View files (19) Download .zip Reputation Support forum Blog Links
 Last Updated Ratings Unique User Downloads Download Rankings 2014-05-24 (2 years ago) Not yet rated by the users Total: 246 This week: 1 All time: 7,429 This week: 1,109
 Version License PHP version Categories price-calculator 1.0.0 BSD License 5.3.0 PHP 5, E-Commerce
Description Author

This package can calculate prices using arbitrary precision math.

It can calculate the prices of goods using different strategies to compute the final price.

Currently it implements strategies to calculate the sales prices based on a value set manually, adding percentage or a fixed value over the original price.

The calculations of the prices are done using arbitrary precision math to avoid losing precision over multiple operations.

Innovation Award
 June 2014 Number 6Prize: One subscription to the PDF edition of the PHP Architect magazine When dealing with money operations it is important to preserve the precision of the operation results as much as possible, so rounding errors do not result in serious financial losses. This class uses arbitrary precision math to avoid rounding errors when performing operations on prices. Manuel Lemos
 Performance Level
Name: Classes: Sergii Pryz `` 6 packages by Sergii Pryz Ukraine 32 1906 32 in Ukraine 19 1 in Ukraine
Innovation award

Nominee: 1x

Details
 ```PriceCalculator ============== Introduction ------------ Library helps calculate products sales price components such as net, gross, vat with using BCMath (http://www.php.net/manual/en/book.bc.php) for all arithmetics operations. Moreover PriceCalculator offers several algorithms to build price net: * Fixed price over purchase price * Fixed percent over purchase price * Manually set net without any margin Additionally it is possible extend library by adding own net price strategy. ### The areas of usage * Calculation product sales price * Form price that's includes several fees like delivery, insurance etc. * Build price that vary from region * Simply calculate VAT, gross, net ### Examples Example can be found here: `/Example.php` ```
 Files
File Role Description
docs (1 directory)
src (1 file, 1 directory)
tests (2 files, 1 directory)
CHANGELOG.md Data Documentation
Example.php Example Example script

 Files / docs
File Role Description
uml (1 file)

 Files / docs / uml
File Role Description
class.diagram.png Data Auxiliary data

 Files / src
File Role Description
PriceCalculator (4 files, 1 directory)
Autoload.php Aux. Class source

 Files / src / PriceCalculator
File Role Description
Strategy (2 files, 1 directory)
AbstractPriceCalculator.php Class Class source
Exception.php Class Class source
PriceCalculator.php Class Class source
PriceCalculatorInterface.php Class Class source

 Files / src / PriceCalculator / Strategy
File Role Description
PriceNet (3 files)
AbstractPriceNet.php Class Class source
PriceNetInterface.php Class Class source

 Files / src / PriceCalculator / Strategy / PriceNet
File Role Description
Manual.php Class Class source
PercentOver.php Class Class source
PriceOver.php Class Class source

 Files / tests
File Role Description
src (1 directory)
bootstrap.php Aux. Class source
phpunit.xml Data Auxiliary data

 Files / tests / src
File Role Description
PriceCalculator (2 files)

 Files / tests / src / PriceCalculator
File Role Description
BaseTest.php Test Class source
CalculatorTest.php Test Class source