Package requires Soap and version 7.1 of PHP or higher.
This package was built on top of this MNB package. Please check out for corresponding documentations.
composer require szunisoft/laravel-mnb
php artisan vendor:publish --provider="SzuniSoft\Mnb\Laravel\MnbServiceProvider" --tag="config"
/*
* Wsdl file location.
* */
'wsdl' => env('MNB_SOAP_WSDL', 'http://www.mnb.hu/arfolyamok.asmx?wsdl'),
'cache' => [
/*
* Desired cache driver for service.
* */
'store' => env('MNB_CACHE_DRIVER', 'file'),
/*
* Minutes the cached currencies will be held for.
* Default: 24hrs (1440)
* */
'minutes' => env('MNB_CACHE_MINUTES', 1440),
]
use SzuniSoft\Mnb\Laravel\Facade\Mnb
$currency = Mnb::currentExchangeRate('EUR');
$currency = app(\SzuniSoft\Mnb\Laravel\Client::class)->currentExchangeRate('EUR');
You can check the feed date by passing a $date variable to some methods. These methods will make variable to be a Carbon instance.
Mnb::exchangeRates($date);
$date->isToday();
These methods won't use and update cache.
- currentExchangeRate($code, &$date = null): Currency
- currentExchangeRates(&$date = null): array of Currency
These methods will use cache.
- exchangeRate($code, &$date = null): single Currency
- exchangeRates(&$date = null): array of currencies
- currencies(): array of strings (each is currency code)
- hasCurrency($code): bool