PHP code example of krzysztofzylka / price

1. Go to this page and download the library: Download krzysztofzylka/price library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

krzysztofzylka / price example snippets


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

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

$price->plusTaxRate(23);

$price->plus(150);

$price->minus(100);

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

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

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

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

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

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