liberusoftware/currency-context
A Laravel package for managing currency context across your application. Detect and set the active currency per request, user, or session, then resolve it consistently for pricing, formatting, and conversion so monetary values display correctly everywhere.
Install and publish the package, then inspect the service provider before using it in application code:
composer require liberusoftware/currency-context
php artisan vendor:publish --provider="LiberuSoftware\CurrencyContext\CurrencyContextServiceProvider"
php artisan migrate
Look first at:
config/currency-context.php for default/base currency, cache, formatter, and rate-provider settings.The first practical use case is storing a product or invoice amount as a precise money value rather than a float, formatting it for display, and converting it to a reporting currency using the exchange rate effective on the transaction date:
use LiberuSoftware\CurrencyContext\ValueObjects\Money;
$price = Money::ofMinor(1299, 'USD'); // $12.99
echo $price->format('en_US');
$converted = $exchangeRates->convert($price, 'EUR', $invoice->issued_at);
Confirm exact class names from the source, because the package has low adoption and may rename internals between releases.
Typical workflow:
composer.json and add integration tests around conversion and formatting.composer.json, and supports your Laravel and PHP versions.2025-01-01 00:00 versus 2025-01-01 23:59 can differ.$12.99 formatting globally.How can I help you explore Laravel packages today?