This is an exchange data provider for Peso that retrieves data from FreecurrencyAPI.
composer require peso/freecurrencyapi-service
Install the service with all recommended dependencies:
composer install peso/freecurrencyapi-service php-http/discovery guzzlehttp/guzzle symfony/cache
<?php
use Peso\Peso\CurrencyConverter;
use Peso\Services\FreecurrencyApiService;
use Symfony\Component\Cache\Adapter\FilesystemAdapter;
use Symfony\Component\Cache\Psr16Cache;
require __DIR__ . '/../vendor/autoload.php';
$cache = new Psr16Cache(new FilesystemAdapter(directory: __DIR__ . '/cache'));
$service = new FreecurrencyApiService('fca_live_...', cache: $cache);
$converter = new CurrencyConverter($service);
// 10760.13 as of 2025-07-18
echo $converter->convert('12500', 'USD', 'EUR', 2), PHP_EOL;
Read the full documentation here: https://phpeso.org/v1.x/services/freecurrencyapi.html
Please file issues on our main repo at GitHub: https://github.com/phpeso/freecurrencyapi-service/issues
The library is available as open source under the terms of the MIT License.