2.0.0 2024-02-07 05:19 UTC

This package is auto-updated.

Last update: 2024-05-07 05:50:05 UTC


README

composer require krzysztofzylka/price

Methods

Price

Global default currency

\Krzysztofzylka\Price\Price::$currency = NULL;

Initialize

Initialize with 50.00

$price = \Krzysztofzylka\Price\Price::of(50)

Add tax rate

Add 23% tax rate

$price->plusTaxRate(23);

Add price

Add 150.00 price

$price->plus(150);

Subtract price

Subtract 100 price

$price->minus(100);

Get amount

echo $price->getAmount();
//173

Get format amount

echo $price->getFormatAmount('EUR');
//173,00 EUR

Calculate

Format amount

\Krzysztofzylka\Price\Calculate::formatAmount(100, 'PLN');
// 100,00 PLN

Calculate vat amount

\Krzysztofzylka\Price\Calculate::calculateVatAmount($amount, $vat)

Calculate net amount

\Krzysztofzylka\Price\Calculate::calculateNetAmount($grossAmount, $vatRate)

Calculate gross amount

\Krzysztofzylka\Price\Calculate::calculateGrossAmount($netAmount, $vatRate)