finller/laravel-money
Laravel Money offers a convenient Money value object for Laravel apps, with Eloquent casts, currency-aware arithmetic, and formatting helpers so you can store, calculate, and display monetary values safely without floating-point errors.
Architecture fit: finller/laravel-money is best treated as a Laravel-facing adapter around Brick/Money, not as a domain model or ledger. It fits well where Eloquent models, form requests, and validation rules need consistent parsing, casting, and validation of monetary values. It is a poor fit as the system of record for payments, accounting, or high-integrity ledger operations unless paired with explicit storage conventions.
Integration feasibility: Feasible for a Laravel application using Composer and standard package auto-discovery. The package is small in surface area and MIT-licensed. Integration should be limited to application/domain boundaries: casts on models, validation rules on requests, and parsing helpers at API/UI edges. It should not replace an existing money abstraction without a migration plan.
Technical risk: The primary risk is low adoption: 19 GitHub stars and a narrow maintainer base create bus-factor and long-term support uncertainty. Secondary risks include dependency compatibility with Laravel, PHP, and Brick/Money; ambiguous locale parsing; currency mismatch; rounding/allocation behavior; and accidental serialization of money objects instead of integer minor units plus ISO currency. A recent release date is positive but does not offset limited ecosystem validation.
Key questions: Which Laravel, PHP, and Brick/Money versions are supported? Does it provide casts, validation rules, and parsing helpers, and are their contracts documented? How are null, zero, negative, invalid currency, and locale-formatted inputs handled? What is the recommended persistence pattern—integer minor units plus currency code? Does it support multi-currency and exchange-rate context, or only single-currency values? What is the maintainer/release cadence and test coverage?
Stack fit: Suitable for Laravel monoliths, modular monoliths, and internal admin/API applications where money handling is localized. Use it at the HTTP validation and Eloquent cast layers. Keep Brick/Money as the value-object layer and store normalized amounts in the database.
Migration path: Start with a spike in one non-critical model and request flow. Compare current behavior—integer cents, floats, custom casts, or moneyphp/money—against the package. Define a persistence standard before rollout: integer minor units, ISO 4217 currency code, and explicit rounding policy. Migrate reads first, then writes, then validation rules.
Compatibility: Pin Composer constraints for Laravel, PHP, and Brick/Money. Verify service-provider discovery, config publishing, and test behavior in CI. Check whether the package’s validation rules and casts are covered by the application’s framework version matrix. Avoid introducing it into a codebase already standardized on another money library unless there is a clear adapter boundary.
Sequencing: 1) Architecture decision record defining money storage and rounding rules. 2) Dependency/version compatibility spike. 3) Pilot on one model and one API endpoint. 4) Add validation and parsing tests for locale, currency, null, and invalid inputs. 5) Expand to additional models. 6) Deprecate legacy helpers and document usage. 7) Add dependency monitoring and upgrade policy.
Maintenance: Low code footprint but non-trivial dependency governance. Track releases of the package, Laravel, PHP, and Brick/Money. Use Composer audit and automated dependency updates. Maintain an internal wrapper or adapter if the package’s API is used broadly, so replacement is possible.
Support: Community-supported MIT package with limited adoption. Expect to self-support edge cases. Assign an internal owner and document money conventions, rounding policy, and serialization rules. Do not rely on the package for regulatory or accounting correctness without independent tests.
Scaling: Runtime overhead is likely negligible relative to database and application work. Scaling concerns are correctness-related: consistent rounding, currency handling, and validation at every boundary. High-volume paths should avoid repeated parsing and should store normalized values, not serialized objects.
Failure modes: Currency mismatch between model and request; float precision loss; locale-dependent parsing ambiguity; invalid cast exceptions on bad historical data; rounding drift in allocations; stale exchange rates if multi-currency is added; and breaking changes from Laravel or Brick/Money upgrades. Add guardrails and tests for each.
Ramp-up: Laravel developers can adopt basic casts and validation quickly. Ramp-up increases for Brick/Money concepts such as monetary contexts, rounding modes, and allocation. Provide examples for storage, API input/output, and validation. Budget a short pilot and a written standard before broad rollout.
How can I help you explore Laravel packages today?