Skip to content

Commit

Permalink
Price calculator
Browse files Browse the repository at this point in the history
* update readme
  • Loading branch information
Dropelikeit committed Jan 15, 2018
1 parent 72ef037 commit da1e40c
Showing 1 changed file with 29 additions and 1 deletion.
30 changes: 29 additions & 1 deletion readme.md
Expand Up @@ -8,4 +8,32 @@
[![Latest Stable Version](https://poser.pugx.org/marcel-strahl/price-calculator/v/stable)](https://packagist.org/packages/marcel-strahl/price-calculator)
[![Latest Unstable Version](https://poser.pugx.org/marcel-strahl/price-calculator/v/unstable)](https://packagist.org/packages/marcel-strahl/price-calculator)
[![License](https://poser.pugx.org/marcel-strahl/price-calculator/license)](https://packagist.org/packages/marcel-strahl/price-calculator)
[![composer.lock](https://poser.pugx.org/marcel-strahl/price-calculator/composerlock)](https://packagist.org/packages/marcel-strahl/price-calculator)
[![composer.lock](https://poser.pugx.org/marcel-strahl/price-calculator/composerlock)](https://packagist.org/packages/marcel-strahl/price-calculator)

The price calculator is designed to simplify the calculation of gross and net prices in cents to euro and euro to cent. Price calculations for other currencies are currently being planned.
Our package is 100% tested!
We will gladly accept your corrections and improvements via a pull request. Please always add testing!

You are also welcome to use the Issue Tracker to set bugs, improvements or upgrade requests.

### Installation

``` composer require marcel-strahl/price-calculator ```

### Example
```
$vat = 19; // Value added tax in Germany
$total = 0;
$price = 300; // cent
$priceCalculator = new PriceCalculator($vat);
$amount = $priceCalculator->addPrice($total, $price); // amount in cent
// If you want to calculate the price including sales tax, use the following method.
$amount = $priceCalculator->calculatePriceWithSalesTax($amount);
// convert to Euro
$amount = (float)$priceCalculator->calculateCentToEuro($amount);
$formatter = new PriceFormatter();
echo $formatter->formatPrice($amount, 2, ',', '.', '€');
```

0 comments on commit da1e40c

Please sign in to comment.