Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Money Laravel Package

brick/money

Brick\Money is a PHP library offering immutable Money and Currency classes with exact arithmetic and explicit rounding control, avoiding floating-point errors. Built on brick/math, it handles any amount size. Requires PHP 8.2+; GMP or BCMath recommended for speed.

View on GitHub
Deep Wiki
Context7

Money and currency library

Frequently asked questions about Money
How do I install brick/money in a Laravel application?
Install it with Composer using composer require brick/money. There is no Laravel service provider, facade, config file, or published assets to register. Current releases require PHP 8.2 or later, and installing ext-gmp or ext-bcmath is recommended for faster arithmetic.
Does brick/money support Laravel 11 and Laravel 12?
brick/money is framework-agnostic and does not declare Laravel version constraints. Its current PHP 8.2+ requirement aligns cleanly with Laravel 11 and Laravel 12 applications. If you are pinned to Laravel 10 with PHP 8.1, use the 0.10 release cycle instead.
Is there a Laravel Eloquent cast or validation rule for Money?
No. brick/money ships immutable value objects such as Money, RationalMoney, Currency, and MoneyBag, but no Laravel-specific integration. You will need to build your own Eloquent cast, validation rule, JSON resource convention, and request-to-Money factory. Keep that adapter work inside the bounded context that owns money handling.
How should I store brick/money values in a Laravel database?
Store monetary amounts as BIGINT minor units or as DECIMAL or string columns, never as FLOAT or DOUBLE. Convert to and from Money in an Eloquent cast or domain service so the database boundary stays exact. Agree early whether your application standardizes on integer minor units or decimal strings.
Why does brick/money throw RoundingNecessaryException?
The library refuses to round silently when a result cannot be represented exactly. You must pass an explicit RoundingMode for operations that may need rounding. Decide whether rounding is per line or per document and get finance or tax sign-off before rollout.
Can brick/money handle currency exchange rates and MoneyBag totals?
brick/money provides exchange-rate provider interfaces and MoneyBag for mixed-currency totals. It does not source FX rates, define staleness tolerance, or manage provider credentials. Implement those concerns in your Laravel application, or defer MoneyBag if you only operate in one currency.
What happens if a float gets into brick/money?
The library accepts integer, string, and big-number input, but any float leaking in from a database column, JSON payload, or third-party API undermines exact arithmetic. Review boundaries where money enters the domain and convert to strings or integers immediately. Treat float contamination as a code review and validation concern.
Is brick/money safe for production despite 0.x versioning?
It is well tested and used in production, but it remains 0.x with breaking changes introduced per minor release cycle. Pin a specific cycle such as 0.14.* and plan scheduled upgrade work instead of passive updates. Because it is effectively single-maintainer MIT software, assign a named internal owner.
How does brick/money compare to moneyphp/money for Laravel projects?
Both are framework-agnostic domain libraries rather than billing subsystems. brick/money is built on brick/math, uses immutable classes, supports any amount size, and forces explicit rounding modes. Choose one library and avoid running two money libraries in the same application.
Do I need GMP or BCMath with brick/money in Laravel?
GMP and BCMath are not strictly required, but they are strongly recommended for performance. Without either extension, arithmetic falls back to pure PHP and can be materially slower under load. Require the extension in composer.json platform config and in your container image if performance matters.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
likyly/sdk
tdt/input
coreation/php-shapefile
coreation/gisconverter
primix/widgets
primix/notifications
primix/actions
primix/tables
primix/details
primix/forms
primix/support
marcelgwerder/laravel-api-handler
firebrikdotcom/conveyor-laravel-broadcaster
kanata-php/conveyor-laravel-broadcaster
alish/short-message
sonrac/lumen-league-oauth2
pushery/sanctum-hardening-for-laravel
evanschleret/laravel-uuidable
yigit-serin/laravel-openvidu
adachsoft/command-executor-lib