- How do I install ashallendesign/laravel-exchange-rates?
- Install it with Composer using composer require ashallendesign/laravel-exchange-rates. Laravel package auto-discovery should register the service provider, but check the README for any publishable config or migration steps. Add your exchangeratesapi.io API key through your .env file or a secrets manager rather than committing it.
- Which Laravel and PHP versions does laravel-exchange-rates support?
- The supported Laravel and PHP constraints are defined in the package composer.json and should be checked on Packagist before installing. Because this is a third-party wrapper, confirm it supports your application's Laravel major version and PHP runtime. If you run an older Laravel release, you may need to upgrade or fork the package.
- Do I need an exchangeratesapi.io API key to use this package?
- Yes. The package is a wrapper around the exchangeratesapi.io HTTP API, so it depends on that third-party service for rates and availability. You normally provide an API key through environment configuration or a secrets manager. Authentication failures and quota errors are controlled by the API provider and should be handled as exceptions in your integration.
- Does laravel-exchange-rates cache exchange rates?
- The package is presented as helping you fetch, cache, and validate exchange rates, so caching is part of its intended workflow. You should still define explicit TTLs per use case, such as spot display, daily close, and historical lookups, and verify how it uses your Laravel cache driver. For billing or reporting, persist the rates you actually used rather than relying only on cache.
- Can I convert currencies with laravel-exchange-rates?
- Yes, the package provides helpers for currency conversion using rates fetched from exchangeratesapi.io. For production use, validate rate precision, rounding behavior, and timestamp semantics before using conversions in pricing, invoicing, or ledgers. It is best to wrap the package behind your own ExchangeRateService so domain code is not coupled directly to the vendor.
- Does it support historical exchange rates?
- Because the package wraps exchangeratesapi.io, historical rate support depends on the API endpoints and plan you provision from the provider. Confirm the historical depth, base-currency restrictions, and quota limits for your plan before relying on it. Store historical rates locally if you need auditability or reconciliation.
- How should I test code that uses laravel-exchange-rates?
- Mock HTTP responses in your test suite instead of calling the live exchangeratesapi.io API. Add contract tests for successful responses, authentication failures, timeouts, malformed payloads, and quota errors. Laravel's HTTP fake utilities or package-level mocking can keep tests deterministic and fast in CI.
- Is laravel-exchange-rates suitable for billing or invoicing?
- Do not use it in billing or invoicing without validation. Rates come from a third-party SaaS API, so you must verify precision, rounding, timestamp semantics, historical consistency, and data licensing terms. Run it in shadow mode against your existing rate source and reconcile results before any financial cutover.
- Can I swap exchangeratesapi.io for another provider later?
- The package is a thin wrapper around exchangeratesapi.io, so switching providers is easier if you hide it behind an internal ExchangeRateService interface. Implement that interface with this package as the first adapter, then add adapters for exchangerate.host, OpenExchangeRates, or a treasury feed later. Avoid calling the package directly throughout your domain code.
- What are the maintenance and production risks of laravel-exchange-rates?
- The package has a single maintainer, modest star count, and limited downstream production evidence, so due diligence is important. Upstream API pricing, quotas, schema changes, and terms are controlled by exchangeratesapi.io, not the package. Pin versions, monitor updates, add timeouts, retries, quota alerts, and a fallback policy before relying on it in production.