PHP code example of peso / frankfurter-service
1. Go to this page and download the library: Download peso/frankfurter-service 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/ */
peso / frankfurter-service example snippets
use Peso\Peso\CurrencyConverter;
use Peso\Services\FrankfurterService;
use Symfony\Component\Cache\Adapter\FilesystemAdapter;
use Symfony\Component\Cache\Psr16Cache;
$cache = new Psr16Cache(new FilesystemAdapter(directory: __DIR__ . '/cache'));
$service = new FrankfurterService(cache: $cache);
$converter = new CurrencyConverter($service);
// 10664.00 as of 2025-12-18
echo $converter->convert('12500', 'USD', 'EUR', 2), PHP_EOL;
bash
composer install peso/frankfurter-service php-http/discovery guzzlehttp/guzzle symfony/cache