Skip to content

SzuniSOFT/php-mnb

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PHP MNB (Magyar Nemzeti Bank)

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'}();