MNB (Magyar Nemzeti Bank) SOAP Client

v1.0.1 2020-03-24 18:21 UTC

This package is auto-updated.

Last update: 2024-04-25 03:34:50 UTC


README

Requirements

This package requires SoapClient and PHP 7.1 or higher.

Note on behavior

MNB Soap client only supports HUF base currency. So the API will return with the well calculated exchange rates based on HUF.

Usage

Initialize

require 'vendor/autoload.php';
$client = new \SzuniSoft\Mnb\Client();

Access list of currencies

Returns with string array. Each element is a currency code.

$currencies = $client->currencies(); // HUF, EUR, ...

Determine currency existence

$client->hasCurrency('EUR'); // true

List of current currency exchange rates

Each element of the returned array will be an instance of SzuniSoft\Mnb\Model\Currency

$exchangeRates = $client->currenctExchangeRates($date);

$exchangeRates[0]->getCode(); // EUR
$exchangeRates[0]->getUnit(); // 1
$exchangeRates[0]->getAmount(); // 300

Obtain exchange rate for specific currency

The returned value will be an instance of SzuniSoft\Mnb\Model\Currency

$currency = $client->currentExchangeRate('EUR');

SoapClient proxy

Client has proxy method call which will invoke the desired method on the SoapClient directly.

$client->{'AnyMethodYouWishToInvoke'}();