1. Go to this page and download the library: Download ivashchukk/pkbp-rates 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/ */
ivashchukk / pkbp-rates example snippets
use Ivashchukk\PkbpRates\Currency;
use Ivashchukk\PkbpRates\PkbpRatesClient;
$client = PkbpRatesClient::create();
$conversion = $client->convert(
10_000, // 100.00 DKK
Currency::DKK,
Currency::EUR,
);
echo $conversion->source->decimal(); // 100.00
echo $conversion->target->decimal(); // 13.21
echo $conversion->rate; // EUR per 1 DKK, as a decimal string
use Ivashchukk\PkbpRates\Currency;
use Ivashchukk\PkbpRates\Dto\Money;
$money = Money::ofDecimal('100.00', Currency::DKK);
$conversion = $client->convertMoney($money, Currency::EUR);
echo $conversion->target->minorAmount; // integer cents
echo $conversion->target->decimal(); // display value