d

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore.

15 St Margarets, NY 10033
(+381) 11 123 4567
ouroffice@aware.com

 

KMF

Get Current and Historical Currency Exchange Rates in Laravel

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 AmrShawkyCurrencyFacadeCurrency;

// Get the current USD -> EUR exchange rate
Currency::convert()
        ->from('USD')
        ->to('EUR')
        ->get();

// Historical exchange rate data
Currency::convert()
        ->from('USD')
        ->to('EUR')
        ->date('2019-08-01')
        ->get();

// Get all of the latest rates
Currency::rates()
        ->latest()
        ->get();

// A more complete example, getting historical rates
Currency::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.


This package was submitted to our Laravel News Links section. Links is a place the community can post packages and tutorials around the Laravel ecosystem. Follow along on Twitter @LaravelLinks


Credit: Source link

Previous Next
Close
Test Caption
Test Description goes like this