peso/currencyapi-service

CurrencyAPI data provider for Peso

1.0.0 2025-07-29 22:45 UTC

This package is auto-updated.

Last update: 2025-07-29 22:51:31 UTC


README

Packagist PHP License GitHub Actions Codecov

This is an exchange data provider for Peso that retrieves data from CurrencyAPI.

Installation

composer require peso/currencyapi-service

Install the service with all recommended dependencies:

composer install peso/currencyapi-service php-http/discovery guzzlehttp/guzzle symfony/cache

Example

<?php

use Peso\Peso\CurrencyConverter;
use Peso\Services\CurrencyApiService;
use Peso\Services\CurrencyApiService\Subscription;
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 CurrencyApiService('cur_live_...', Subscription::Free, cache: $cache);
$converter = new CurrencyConverter($service);

// 10777.50 as of 2025-07-30
echo $converter->convert('12500', 'USD', 'EUR', 2), PHP_EOL;

Documentation

Read the full documentation here: https://phpeso.org/v1.x/services/currencyapi.html

Support

Please file issues on our main repo at GitHub: https://github.com/phpeso/currencyapi-service/issues

License

The library is available as open source under the terms of the MIT License.