dev-master
9999999-devWrapper for multiple currency rate APIs
MIT
The Requires
- php >=7.1
The Development Requires
by Lasse Rafn
by Rackbeat
laravel api currency rates exchange rates currency conversion currency rates
Wrapper for multiple currency rate APIs
Dont worry about your favorite service suddenly shutting down or switching plans on you. Switch away easily., (*1)
You just require using composer and you're good to go!, (*3)
composer require rackbeat/php-currency-api
If you're using Laravel, a service provider and facade is included to provide configuration of driver etc., (*4)
$api = Rackbeat\Currency\API::make('fixerio'); // driver from supported drivers.
$api->setBase(Rackbeat\Currency\Symbol::USD);
$api->setSymbols([ Rackbeat\Currency\Symbol::DKK, Rackbeat\Currency\Symbol::EUR, Rackbeat\Currency\Symbol::USD ]);
Please note, you are not required to use Rackbeat\Currency\Symbol
to specify symbols. It's simply a convenience helper., (*5)
$api->get(); // Get latest rates for selected symbols, using set base currency $api->get('DKK'); // Get latest rates for selected symbols, using DKK as base currency
$api->convert($fromCurrency = 'DKK', $toCurrency = 'EUR', 10.00); // Convert 10 DKK to EUR
$api->historical($date = '2018-01-01'); // Get currency rate for base on 1st of January 2018 $api->historical($date = '2018-01-01', 'GBP'); // Get currency rate for GBP on 1st of January 2018
... todo, (*6)
Wrapper for multiple currency rate APIs
MIT
laravel api currency rates exchange rates currency conversion currency rates