PHP code example of byte5digital / currency-converter
1. Go to this page and download the library: Download byte5digital/currency-converter library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
byte5digital / currency-converter example snippets
// Converting currencies
Currency::convert(100, 'EUR')->into('USD');
// get currency rates
Currency::getLatestRates();
// get rates for different base (default: EUR)
Currency::setBase('USD')->getLatestRates();
// get specific currency rates
Currency::getLatestRates(['USD', 'GBP']);
Currency::getLatestRates('USD');
// get historical currency rates
Currency::getHistoricalRates('2000-01-03');
Currency::getHistoricalRates(Carbon::yesterday());
Currency::getHistoricalRates('2000-01-03', ['USD', 'GBP']);