LaravelPackages.net
Acme Inc.
Toggle sidebar
fomvasss/laravel-currency

Laravel package for working with multiple currencies, providing currency conversion, exchange rate management, and formatted output

378
3
2.8.1
About fomvasss/laravel-currency

fomvasss/laravel-currency is a Laravel package for laravel package for working with multiple currencies, providing currency conversion, exchange rate management, and formatted output. It currently has 3 GitHub stars and 378 downloads on Packagist (latest version 2.8.1). Install it with composer require fomvasss/laravel-currency. Discover more Laravel packages by fomvasss or browse all Laravel packages to compare alternatives.

Last updated

Laravel Currency

License Latest Stable Version Total Downloads

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 CurrencyRateFetchFailed event
  • Formatting with symbol, precision and separators per currency
  • Helpers, Blade directives, currency:rates and currency:convert commands

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/.

License

MIT — see LICENSE.

Support

If this package is useful to you, consider supporting its development:

Monobank Ko-Fi USDT TRC20

USDT TRC20 address: THLgp6DxiAtbNHvgnKV56vk1L38UuUagKf

Comments