a21ns1g4ts/filament-brl-money-field
A Filament form field for Brazilian Real (BRL) monetary values, offering currency masking, formatting, and smooth integration with Filament forms. Makes entering and displaying amounts in Brazilian currency simple in Laravel admin panels.
R$ 1.234,56 instead of raw decimals, with locale-correct parsing.decimal(15,2), and convert exactly once at the dehydration boundary. That's a product-relevant decision (reporting, exports, accounting reconciliation), not just an engineering detail.Consider it when all of the following hold:
composer.json constraint explicitly; do not assume a patch release widened it) and forms are built with Filament fields.0, 1.234,56, negative, and empty input, asserting the stored database value (not just the rendered input).^1.0, review the v1.0.0...v1.0.1 diff once, and vendor or fork if the maintainer goes quiet.Look elsewhere (or build a small internal field) when:
dehydrateStateUsing() trap (double ×100) becomes a live production risk.For executives (30 seconds). This is a small, MIT-licensed UI component that gives our Filament admin the familiar Brazilian currency input (R$ 1.234,56) and stores clean decimals — instead of us hand-building and maintaining that formatting logic in every form. It's cheap to try and cheap to remove. The real risks are not financial: they're (a) compatibility with our Filament version and (b) getting the display-to-database conversion right. We mitigate both with a short, timeboxed spike and one persistence test per money field. Recommendation: approve a 1–2 day evaluation, adopt only behind tests, and treat the code as something we could own if the maintainer disappears.
For engineering. Drop-in Filament form component; no config necessarily required (publish if a config tag exists). Before writing form code: confirm the Filament/Laravel/Livewire/PHP constraints in composer.json, inspect src/ for the field class and fluent methods, and determine whether dehydration to cents is built in — if it is, adding our own dehydrateStateUsing() multiplies by 100 twice. Standardize on integer cents (bigInteger) or decimal(15,2) — never float — and convert exactly once at the dehydration boundary, mirrored by a matching model cast. Remember validation sees the masked string, so numeric/decimal rules won't work; normalize before validating or use a custom rule. Confirm the mask survives Livewire hydration (->call('$refresh')) and test negative, zero, and empty input. Pin ^1.0, review the v1.0.1 diff once, and add integration tests through a Livewire form component that assert the stored value. Because the package is small and low-adoption, keep it behind a thin internal wrapper (or a forked namespace) so it can be replaced without touching every resource.
How can I help you explore Laravel packages today?