fomvasss / laravel-currency
Laravel package for working with multiple currencies, providing currency conversion, exchange rate management, and formatted output
2.8.1
2026-10-07 16:05 UTC
Requires
- php: ^8.1
- illuminate/cache: ^9|^10|^11|^12|^13
- illuminate/http: ^9|^10|^11|^12|^13
- illuminate/support: ^9|^10|^11|^12|^13
Requires (Dev)
- orchestra/testbench: ^8|^9|^10|^11
- phpunit/phpunit: ^10|^11|^12
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
Currency conversion, exchange rates and money formatting for Laravel. Rates come from pluggable providers — Monobank, PrivatBank, NBU, jsDelivr currency-api, ExchangeRatesAPI, CurrencyAPI, Fixer, or your own — and are cached with a fallback for when the API is down.
- Conversion with buy / sell / average rates
- Seven built-in providers, switchable at runtime, plus custom ones via a small contract
- Historical rates — convert at the rate of a past date
- Base currency override with automatic rate recalculation
- Caching with a long-term fallback cache and a
CurrencyRateFetchFailedevent - Formatting with symbol, precision and separators per currency
- Helpers, Blade directives,
currency:ratesandcurrency:convertcommands
Requirements
- PHP ^8.1
- Laravel 9 – 13
Installation
composer require fomvasss/laravel-currency php artisan vendor:publish --tag=currency-config
CURRENCY_DEFAULT_PROVIDER=monobank
Quick start
use Fomvasss\Currency\Facades\Currency; Currency::convert(100, 'USD', 'UAH'); // average rate Currency::convert(100, 'USD', 'UAH', 'sell'); Currency::getRate('EUR'); // UAH per 1 EUR Currency::format(1234.5, 'USD'); // "$ 1,234.50" Currency::useProvider('nbu')->convertAt(100, 'USD', 'UAH', now()->subYear());
php artisan currency:rates --provider=nbu php artisan currency:convert 100 usd eur --format
Documentation
Online: https://fomvasss.github.io/laravel-currency/ — the same pages as in docs/.
- Installation · Configuration
- Converting & rates · Rate providers · Base currency · Historical rates
- Formatting & currencies · Helpers & Blade · Caching & failures · Custom providers
- Reference: Currency facade · Providers · Contracts, events & manager · Commands
- Upgrading · Changelog
License
MIT — see LICENSE.
Support
If this package is useful to you, consider supporting its development:
USDT TRC20 address:
THLgp6DxiAtbNHvgnKV56vk1L38UuUagKf