PHP code example of ujjwal / currency-converter
1. Go to this page and download the library: Download ujjwal/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/ */
ujjwal / currency-converter example snippets
verter = new CurrencyConverter\CurrencyConverter;
echo $converter->convert('USD', 'NPR'); // will print something like 97.44
// caching currency
$cacheAdapter = new CurrencyConverter\Cache\Adapter\FileSystem(__DIR__ . '/cache/');
$cacheAdapter->setCacheTimeout(DateInterval::createFromDateString('10 second'));
$converter->setCacheAdapter($cacheAdapter);
echo $converter->convert('USD', 'NPR');