MNB (Magyar Nemzeti Bank) SOAP Client

v2.0.0 2024-06-06 12:52 UTC

This package is not auto-updated.

Last update: 2025-03-28 11:26:01 UTC


README

Requirements

This package requires SoapClient and PHP 8 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 \Extradevs\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 Extradevs\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 Extradevs\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'}();