florianv/exchanger
Exchanger is a PHP framework for retrieving currency exchange rates from multiple providers (Fixer, Currency Data, Exchange Rates Data, and more). It offers a unified API for live and historical rates, supporting different base/quote currency constraints per service.
php-http/guzzle6-adapter or php-http/guzzle7-adapter.Fixer, CurrencyData) can be registered as Laravel bindings with API keys stored in .env.ExchangeRateQueryBuilder can be wrapped in a Laravel service class for consistency.exchangeratesapi.io) may sunset APIs; the package lacks built-in versioning checks.app-name-currencies-) may truncate.coinlayer and Cryptonator; not ideal for fiat-crypto hybrid systems.php-http/mock-client or similar tools..env?Chain service introduce latency? Should rates be batched?php-http/guzzle7-adapter for HTTPlug compatibility.redis, database) with cache/simple-cache-bridge..env and bind services to Laravel’s container.app:fetch-rates job).composer require php-http/guzzle7-adapter nyholm/psr7 florianv/exchanger cache/simple-cache-bridge
composer require cache/redis-adapter # For Redis
composer require cache/database-adapter # For DB
Chain service with fallback logic.Handler for HTTP exceptions).cache/redis-adapter) work with Laravel’s cache config.config/app.php to resolve HTTPlug clients.Fixer, Chain) with API keys from .env.config/cache.php or via service binding.ExchangeRateQueryBuilder for consistency.florianv/exchanger, HTTPlug, and Laravel HTTP components.FixerException, CurrencyDataException) for debugging.cache_ttl, cache_key_prefix) and their impact.currency_pair and date.| Failure Scenario | Impact | Mitigation |
|---|---|---|
| Provider API downtime | No exchange rates available | Use Chain service with multiple providers; implement queue retries. |
| Rate limit exceeded | Throttled requests | Monitor usage; implement exponential backoff; upgrade provider plan. |
| Cache corruption | Stale rates served | Use short TTLs; implement cache validation (e.g., checksums). |
| Provider API deprecation | Broken functionality | Deprecate affected providers; migrate to alternatives. |
| High latency | Slow checkout/pricing flows | Optimize cache TTLs; use faster providers (e.g., ECB for EUR-based rates). |
| Currency pair unsupported | Invalid queries | Validate currency pairs before querying; log unsupported pairs. |
.env examples.ExchangeRateService class for common use cases (e.g., `convert($amount, $from, $How can I help you explore Laravel packages today?