What is Laravel Brick Money?
Laravel Brick Money is a Laravel package that wraps the Brick/Money library with Laravel-specific conveniences including:- Eloquent model casts for storing money in databases
- Request macros for handling money input
- Validation rules for money and currency
- Blade components and directives
- Helper functions for quick money creation
- Livewire synthesizers for seamless integration
Why Use Laravel Brick Money?
Type Safety
Immutable Money objects prevent accidental mutations and provide type-safe monetary calculations with proper rounding.
Currency Aware
Built-in support for 150+ currencies with proper formatting, symbols, and decimal places.
Laravel Integration
Eloquent casts, validation rules, Blade components, and helpers make it feel native to Laravel.
Precision Math
Uses arbitrary precision arithmetic to avoid floating-point errors in financial calculations.
Key Features
Powerful Money Operations
Perform mathematical operations on money values with confidence:Flexible Storage Options
Store money in your database using integer (minor units) or decimal (major units):Currency Formatting
Automatic formatting based on currency rules:Request Validation
Validate money and currency input with built-in rules:Common Use Cases
E-commerce Applications
E-commerce Applications
Handle product prices, shopping carts, order totals, taxes, and discounts with precision. Support multiple currencies for international sales.
Financial Services
Financial Services
Process transactions, calculate interest, handle account balances, and perform currency conversions with accurate arbitrary-precision arithmetic.
Subscription Services
Subscription Services
Calculate recurring payments, prorate charges, handle upgrades/downgrades, and manage credits with confidence.
Invoicing Systems
Invoicing Systems
Generate invoices with line items, apply taxes, calculate totals, and format amounts according to locale and currency.
Quick Example
Here’s a complete example showing how easy it is to work with money in Laravel:Browser Support
Laravel Brick Money is a server-side package and works with all Laravel-supported PHP versions (8.2+). The formatted output can be displayed in any browser.
System Requirements
- PHP 8.2 or higher
- Laravel 10.x, 11.x, or 12.x
- Brick/Money 0.10.0 or higher
- ext-intl (optional, for locale-based formatting)
Next Steps
Installation
Install Laravel Brick Money via Composer and configure it for your application.
Configuration
Learn how to customize default currency settings and configure custom currencies.