apie / exchange-rate
Composer package of the apie library: exchange rate
Requires
- php: >=8.4
- apie/core: dev-main
- symfony/http-client: ^7.2
Requires (Dev)
- phpspec/prophecy-phpunit: ^2.5
- phpunit/phpunit: ^11.5.2
Suggests
None
Provides
None
Conflicts
None
Replaces
None
This package is auto-updated.
Last update: 2026-10-01 07:11:40 UTC
README
exchange-rate
This package is part of the Apie library. The code is maintained in a monorepo, so PR's need to be sent to the monorepo
Documentation
Looks up currency exchange rates for use in Apie domain objects (e.g. money value objects).
Standalone usage
Install it with:
composer require apie/exchange-rate
Create an ExchangeRateService and pass ISO 4217 currency codes as strings:
use Apie\ExchangeRate\ExchangeRateService; $service = new ExchangeRateService(); $rate = $service->calculateConversionRate('USD', 'EUR');
Rates are retrieved from the public Frankfurter API.
Symfony integration
Via apie/apie-bundle, exchangerate.yaml is loaded automatically and registers Apie\ExchangeRate\ExchangeRateService, using the Symfony http_client service if one is configured.
Laravel integration
Via apie/laravel-apie, the generated Apie\ExchangeRate\ExchangeRateServiceProvider is auto-registered and binds ExchangeRateService into the Laravel container.