ipaulk / exchange-rates
Retrieve currency exchange rate using several web services.
1.1.0
2017-03-22 14:37 UTC
Requires
- php: >=5.5
- guzzlehttp/guzzle: ~6.0
This package is not auto-updated.
Last update: 2025-06-08 00:04:57 UTC
README
Retrieve currency exchange rate using several web services.
Available webservicess:
- WebserviceX.NET Data Protocol is a SOAP-inspired technology for reading, writing, and modifying information on the web.
- Fixer.io is a free JSON API for current and historical foreign exchange rates published by the European Central Bank.
Installation
$ composer require ipaulk/exchange-rates
Usage
Get specific exchange rate from Webservicex.net (by default)
use IPaulK\ExchangeRates\ExchangeRates as ExchangeRates; $exchangeRates = new ExchangeRates(); /** @var float $value */ $value = $exchangeRates->getRate('USD', 'EUR');
Get specific exchange rate from fixer.io
use IPaulK\ExchangeRates\ExchangeRates as ExchangeRates; $exchangeRates = new ExchangeRates(); $exchangeRates->setProvider('fixerio'); /** @var float $value */ $value = $exchangeRates->getRate('USD', 'EUR');
Request specific exchange rates.
use IPaulK\ExchangeRates\ExchangeRates as ExchangeRates; $exchangeRates = new ExchangeRates(); /** @var array $data */ $data = $exchangeRates->fetchRates('USD', ['EUR', 'GBP', 'JPY', 'RUB', 'ILS', 'AUD']);