Documentation Index
Fetch the complete documentation index at: https://mintlify.com/devhammed/laravel-brick-money/llms.txt
Use this file to discover all available pages before exploring further.
Overview
Laravel Brick Money provides two Blade components for rendering monetary values and currency information in your templates. These components offer a clean, declarative syntax for displaying formatted money and currency data.Money Component
The<x-money /> component renders formatted monetary values with automatic currency formatting.
Basic Usage
Component Attributes
The monetary amount to display. Can be a number, string, or BigNumber instance.
The currency code (e.g., “USD”, “EUR”, “GBP”). Defaults to the configured currency in your
brick-money.php config file.Whether the amount is in minor units (e.g., cents). When
true, an amount of 100 represents 100.00. Defaults to the configured value in your brick-money.php config file.A Brick\Money\Context instance for custom precision handling. Advanced use cases only.
The rounding mode to use from
Brick\Math\RoundingMode. Options include UP, DOWN, CEILING, FLOOR, HALF_UP, HALF_DOWN, HALF_CEILING, HALF_FLOOR, HALF_EVEN, and UNNECESSARY.Examples
- Display Product Price
- Show Cart Total
- Database Minor Units
- Multiple Currencies
Implementation Details
The<x-money /> component is implemented in Devhammed\LaravelBrickMoney\View\Components\Money and renders using the money() helper function internally.
money() helper:
Currency Component
The<x-currency /> component renders formatted currency information.
Basic Usage
Component Attributes
The currency code to display (e.g., “USD”, “EUR”, “GBP”).
Examples
- Display Currency Code
- Currency Selection
- Transaction Details
Implementation Details
The<x-currency /> component is implemented in Devhammed\LaravelBrickMoney\View\Components\Currency and renders using the currency() helper function internally.
currency() helper:
Component Registration
Both components are automatically registered in the package service provider:The components are available as soon as you install the package. No additional configuration is required.
Related
- Blade Directives - Alternative syntax using
@moneyand@currencydirectives - Helper Functions - Use
money()andcurrency()helpers directly in PHP code - Configuration - Set default currency and minor unit behavior