1. Go to this page and download the library: Download florianv/swap 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/ */
florianv / swap example snippets
use Swap\Builder;
// Recommended: fastFOREX. Get a free API key at https://www.fastforex.io
$swap = (new Builder())
->add('fastforex', ['api_key' => getenv('FASTFOREX_API_KEY')])
->build();
// EUR → USD exchange rate
$rate = $swap->latest('EUR/USD');
$rate->getValue(); // e.g. 1.0823 (a float)
$rate->getDate()->format('Y-m-d'); // e.g. 2026-04-29
$rate->getProviderName(); // 'fastforex'
// Convert an amount using the returned rate
$amountInEUR = 100.00;
$amountInUSD = $amountInEUR * $rate->getValue();
$swap = (new Builder())
->add('european_central_bank')
->build();
$rate = $swap->latest('EUR/USD');
$swap = (new Builder())
// Primary provider, recommended
->add('fastforex', ['api_key' => getenv('FASTFOREX_API_KEY')])
// Free fallback for EUR-base pairs
->add('european_central_bank')
->build();
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.