Laravel Currency is a package that provides current and historical exchange rates for currency and cryptocurrencies. The package leverages the exchangerate.host API for exchange rate data, and has a clean API for getting data:
use AmrShawky\Currency\Facade\Currency; // Get the current USD -> EUR exchange rateCurrency::convert() ->from('USD') ->to('EUR') ->get(); // Historical exchange rate dataCurrency::convert() ->from('USD') ->to('EUR') ->date('2019-08-01') ->get(); // Get all of the latest ratesCurrency::rates() ->latest() ->get(); // A more complete example, getting historical ratesCurrency::rates() ->historical('2020-01-01') ->symbols(['USD', 'EUR', 'CZK']) ->base('GBP') ->amount(5.66) ->round(2) ->source('ecb') ->get();
You can learn more about this package, get full installation instructions, and view the source code on GitHub. You can learn more about the exchangerate.host API by reading the official API documentation.
0 comments:
Post a Comment
Thanks