- How do I install kantorge/laravel-currency-exchange-rates in Laravel?
- Install it with Composer using composer require kantorge/laravel-currency-exchange-rates. Laravel package discovery should register the service provider automatically. Then publish and review the package configuration before selecting providers or enabling caching.
- Which currency exchange rate providers does this package support?
- The package is designed to integrate multiple exchange rate providers rather than locking you into one source. Provider selection is configurable, so you can choose the source that fits your accuracy, coverage, and rate-limit needs. Check the package documentation for the exact provider adapters included in your version.
- Can I cache exchange rates to reduce API calls?
- Yes. Caching is a core part of the package's purpose: it can fetch rates and cache them so you avoid hitting provider APIs on every request. You configure the cache behavior through the package configuration, and you should align TTLs with how often your chosen provider updates rates.
- Does it store historical exchange rate data?
- Yes, the package is built to retrieve and manage historical currency exchange rate data. That lets you store past rates and use them for conversions, reporting, or reconciliation instead of relying only on the latest quote. The exact storage model and retention options are documented in the package configuration.
- How do I convert currencies using this package?
- Use the package's conversion API after rates have been fetched or loaded from storage. You typically specify the source currency, target currency, amount, and sometimes a date for historical conversion. The clean, configurable API is intended to keep conversion logic out of your controllers and models.
- Is this package compatible with my Laravel version?
- Compatibility depends on the package's Composer constraints, so check its composer.json for the supported PHP and illuminate/support versions. The package is Laravel-focused, but version support can change between releases. If you are on an older or very new Laravel version, test installation in a branch before upgrading production.
- How do I configure multiple rate providers?
- Provider configuration is handled in the package config file, where you can define which provider or providers to use. You can keep different settings per environment, such as a test provider locally and a production provider in production. Review each provider's API key, base URL, and rate-limit requirements before enabling it.
- How should I test code that uses this package?
- Keep tests deterministic by faking HTTP calls if your provider uses Laravel's HTTP client, or by pointing the package config at a stub provider. Avoid hitting real exchange rate APIs in your test suite because rates change and providers enforce rate limits. Then assert your conversion and storage logic against known fixture rates.
- What are production considerations for exchange rate data?
- In production, cache aggressively but respect provider update frequency, rate limits, and licensing terms. Historical rate storage can grow over time, so plan retention and indexing for date and currency pair lookups. Also schedule rate updates and monitor failures so stale rates do not silently affect financial calculations.
- What alternatives exist to this package?
- Alternatives include calling an exchange-rate API directly, using another Laravel currency package, or building a small service around a provider SDK. This package is most useful when you want multiple providers, caching, historical data, and conversion in one Laravel-integrated API. Compare provider coverage, historical depth, and maintenance activity before choosing.