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
Filament Ptbr Form Fields

Filament Ptbr Form Fields Laravel Package

leandrocfe/filament-ptbr-form-fields

Brazilian-ready form fields for Filament: CPF/CNPJ, CEP, phone, and currency inputs with masks, validation, and PT-BR labels. Drop-in Laravel components to speed up admin panels and forms for Brazil.

View on GitHub
Deep Wiki
Context7

This package provides custom form fields for Filament (>=v2.17.28) that are commonly used in Brazilian web applications, such as CPF/CNPJ validation, phone number formatting, money with currency symbol, and CEP integration with ViaCep.

Frequently asked questions about Filament Ptbr Form Fields
How do I install leandrocfe/filament-ptbr-form-fields in a Laravel application?
Install it with Composer using composer require leandrocfe/filament-ptbr-form-fields. There are no migrations, models, or database tables to create because the package only supplies Filament form field components. After installing, import the field classes into your Filament form schema and use them like any other Filament field.
Which Laravel and Filament versions does this package support?
The package targets Filament 2.17.28 and above, so it is aimed at Filament v2-era panels rather than arbitrary Filament majors. Release 5.0.1 widened the Laravel constraint to declare compatibility with Laravel 13.x. Treat that as a declared constraint rather than proof of testing, and read the composer.json at the exact tag to confirm the php, illuminate, and filament/filament ranges overlap your pinned versions before upgrading.
How do I add a CPF/CNPJ field with validation to a Filament form?
Use the package's CPF/CNPJ field in your form schema in place of a plain text input. It applies the Brazilian document mask as the user types and validates the CPF or CNPJ check digits so malformed numbers are rejected before they reach your persistence layer. Because the check runs on the server as well, you get protection even if the browser-side mask is bypassed. Normalize the stored value, typically to digits only, before saving it to a database column.
Does the CEP field look up the address automatically through ViaCep?
Yes, the CEP field integrates with ViaCep to fetch address data after a postal code is entered. That means the component makes an outbound HTTP request, so plan for failures, timeouts, and offline users by keeping the address fields editable rather than read-only. In test suites, fake the HTTP client so tests never hit the live ViaCep service, and consider caching results if the same CEPs recur.
How does the phone number field handle Brazilian formatting?
The phone field applies a Brazilian phone mask while the user types, covering both landline and mobile patterns. Decide early whether your database column stores the raw digits or the formatted string and normalize on save so queries and integrations stay predictable. Combine the mask with a length or pattern validation rule if your application needs to reject incomplete numbers.
How do I use the money field with a Brazilian real symbol?
The money field renders a currency input with the R$ symbol and handles the decimal separator expected by Brazilian users. Store the resulting value in a decimal or integer-cents column and cast it explicitly in your Eloquent model rather than relying on floats. Verify how the component emits the value, formatted string or numeric, before wiring it into mass assignment or API payloads.
Do I need to publish config files or run migrations after installing this package?
No. The package is a presentation-layer plugin and does not ship migrations, models, or side-effecting service providers that restructure your application. Installation is a Composer require plus using the field classes in your Filament schemas. That low coupling also means you can remove it later by swapping the affected fields for custom Filament components.
How should I test forms that use these PT-BR fields?
Test the fields the same way you test any Filament form, using Livewire component tests against your resources and pages. For the CEP field, use Laravel's HTTP fake so the ViaCep request is stubbed and your tests stay deterministic and fast. Assert both the displayed masked value and the value that ends up persisted, since mask-versus-storage mismatches are the most common source of bugs with masked inputs.
Is upgrading to 5.0.1 safe, and what changed with the illuminate/contracts dependency?
5.0.1 is a patch release that does not change component signatures, config keys, or runtime field behavior. It removes the direct illuminate/contracts requirement and widens the Laravel constraint to include 13.x, alongside CI-only Dependabot bumps. Upgrade in a branch with composer update leandrocfe/filament-ptbr-form-fields --with-dependencies and diff the lockfile for movement in illuminate and filament transitive versions, then smoke test every form that uses the fields.
What are the alternatives if this package is abandoned or does not support my Filament version?
Because the package is presentation-only, the fallback is straightforward: replace the affected fields with custom Filament field classes or a small set of your own masked inputs, since the underlying capability is masking and CPF/CNPJ validation rather than anything proprietary. Count how many forms actually consume these fields to size the swap. If you stay on a different Filament major line, confirm which plugin release matches it, or vendor the field classes you need.
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.
jinas/dhivatar
store-doc/laravel-storage-driver
plus-it/laravel-translation-manager
diephp/perhaps
diephp/telegraph
osmaviation/spreadsheet
microsoft/fluentui-system-icons
mmccook/php-json-canonicalization-scheme
middlewares/firewall
qubiqx/montapacking
nyoncode/laravel-package-console
pnscripts/filament-broadquill-lite
pnscripts/laravel-sentfold-lite
vleap/mx-sdk-laravel-internal
twidpay/utils
htetmyathlaing/scout-elasticsearch-driver
artisan-toolbox/front-awesome
ls/client-assistant
users-au/laravel-client
cgv/localized-resource