PHP code example of brunoinds / frankfurter-laravel
1. Go to this page and download the library: Download brunoinds/frankfurter-laravel 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/ */
brunoinds / frankfurter-laravel example snippets
use Brunoinds\FrankfurterLaravel\Exchange;
use Brunoinds\FrankfurterLaravel\Enums\Currency;
// Get current exchange rate
$result = Exchange::now()->convert(Currency::USD, 1)->to(Currency::BRL);
// Get historical exchange rate
$date = new DateTime('2023-12-10');
$result = Exchange::on($date)
->convert(Currency::USD, 1)
->to(Currency::BRL);
echo $result // 0.27