lexik/currency-bundle
Symfony bundle for multi-currency apps: manages currency definitions, fetches exchange rates from configurable providers, converts amounts, and integrates with Twig, forms, and Doctrine. Ships with caching, CLI tools, and an extensible provider architecture. Ideal for e-commerce and billing.
Architecture fit — poor as a dependency, moderate as a reference. This is a Symfony2 bundle, not a framework-agnostic library. Everything of value is wired through Symfony's DependencyInjection extension and consumed as $container->get('lexik_currency.converter'), with presentation delivered as a Twig extension. Laravel has no bundle/DI-extension concept, no auto-discovered service provider, and the package does not target illuminate/*. There is no drop-in integration path.
Decomposing what the package actually contains:
| Component | Reusable in Laravel? | Notes |
|---|---|---|
| Conversion math (rate multiply + rounding) | Yes, but trivial | ~50 LOC, not worth a dependency |
| ECB exchange-rate provider (HTTP fetch + XML parse) | Yes — the only real asset | ~100–200 LOC |
| Doctrine ORM persistence of rates | No | Conflicts with Eloquent |
| Twig filters/directives | No | Useless in Blade |
| Symfony DI/config tree | No | Dead weight |
Integration feasibility — low. composer require into a Laravel 10/11 app will almost certainly fail or drag in Symfony 2.x components that conflict with the framework's symfony/* v6/v7 constraints. Forcing it with --ignore-platform-reqs inherits an unmaintained transitive tree.
Technical risk — high. Symfony2 has been EOL since 2018; PHP constraints are likely ^5.3|^7.0. No security patching, no CVE process, 58 stars and 0 dependents means effectively no third-party review. The ECB reference feed is a single upstream with no fallback provider in the bundle.
Key questions to resolve before committing:
as_of timestamps?Stack fit: treat this as a reference implementation, not a package. Recommended decision: do not composer require it.
Target stack: moneyphp/money (or brick/money) for arithmetic, a first-party ExchangeRateProvider interface, a ported ECB adapter, and a cached rate table.
Migration path:
app/Services/Fx/EcbRateProvider.php implementing a local interface; use Laravel's Http client and SimpleXMLElement.currency_rates table keyed (base, quote, rate, as_of, source).Cache::remember with a 15–60 minute TTL.Money cast/accessor and a format() helper.fx:refresh-rates in routes/console.php for after ~16:00 CET on TARGET business days.Compatibility: target PHP 8.2+ / Laravel 10–11. Retain zero Symfony2 artifacts. If a side-by-side evaluation is mandated, isolate the bundle behind an adapter and never let its Doctrine entity into the application schema.
Sequencing: (1) interface + fixed-rate table to unblock pricing work; (2) ECB adapter + scheduler; (3) Blade formatting layer; (4) multi-provider failover only if the SLA demands it.
Effort: roughly 2–4 dev-days for the port plus tests. The bundle itself saves perhaps half a day — a negative ROI once conflict resolution and review are counted.
Maintenance: if vendored, you own it outright — no upstream fixes will arrive. If forked, budget ~0.5 day/quarter. If reimplemented as recommended, ~1 day/year. Note the repository shows no meaningful community activity, so "wait for upstream" is not a strategy.
Support: none. Single maintainer organization, no visible security disclosure process, 58 stars. Assume internal ownership from day one.
Scaling: compute cost is negligible. The only external dependency is the daily upstream fetch, so throughput is bounded by cache hit rate on the rate table — comfortably thousands of RPS with a 15-minute TTL and an in-memory/Redis cache.
Failure modes to design against:
as_of staleness guard, an alert at >48h, and fail-closed behavior on checkout pricing.Ramp-up: low. A mid-level Laravel engineer can complete the port in half a day. The review time belongs to domain nuance — rounding policy, triangulation, rate provenance — not to the code itself.
Verdict: extract the ECB provider, discard the rest. The package is a useful prior-art reference for FX plumbing and a poor production dependency for a Laravel application.
How can I help you explore Laravel packages today?