jeffersongoncalves/filament-cnpj-field
A Filament form field for Brazilian CNPJ input, adding masking and validation to Laravel admin panels. Simplifies collecting and verifying company registration numbers in Filament forms.
Architecture fit. The package is a Filament form-field plugin, not a general-purpose CNPJ library. It contributes a single field type (CnpjInput) to Filament's form builder and delegates validation/lookup to jeffersongoncalves/laravel-cnpj. That is a deliberately narrow architectural footprint: one class registered in a form schema, no service provider hijacking of core behavior, no persistence layer of its own. For any application already running Filament panels, this is a low-coupling addition. For anything outside Filament, it is not applicable — the underlying laravel-cnpj package would be the correct integration point instead.
Integration feasibility. Presumed to be a standard Composer install plus a field reference in the form schema (CnpjInput::make('cnpj')). Effort is measured in hours, not days, provided the host application is already on Filament v5. The three capabilities — mask, check-digit validation, and Minha Receita lookup — are independently valuable and should be independently toggleable; that configurability is the main thing to confirm before committing.
Technical risk. Several concerns warrant flagging to the steering group:
laravel-cnpj appear to sit with the same author. Concentration risk is real: one person's availability governs our ability to patch a validation bug.Key questions for the maintainer / spike.
laravel-cnpj)?Stack fit. Requires Laravel (presumed 11/12) plus Filament v5. If our target application is on Filament v3 or v4 — still the common case — this package is not usable today and the decision is really "when do we move to Filament v5," which is a much larger question than a CNPJ field.
Migration path. Effectively greenfield; there is no prior assessment and no incumbent to displace. The real migration concern is data, not code: if we already store CNPJ values, we must confirm the storage column is a string type wide enough for alphanumeric CNPJ (14 characters, now potentially non-numeric). Any BIGINT/NUMERIC CNPJ column becomes a hard blocker and a schema migration. Masked values must be normalized (strip punctuation and, if applicable, casing) before persistence.
Compatibility. Verify no collision with an existing CNPJ validation rule or another Filament CNPJ field — duplicate field names or competing service providers are the most likely integration failure. Also confirm the package's Filament constraint is a minor-tolerant range, not a pinned 5.0.x, or every Filament patch release becomes our problem.
Sequencing.
Maintenance. Two packages to track, both young and both single-maintainer. Pin exact versions, subscribe to release notifications, and budget a small recurring allowance for tracking Filament v5 minor releases — field packages break on form-API changes more often than on anything else. Our fork-or-wrap posture should be decided up front: if we subclass the field to add caching and timeout policy, upgrades become cheaper and we insulate ourselves from abandonment.
Support. No SLA, no vendor to escalate to. Internal owners must be able to read the validation and lookup code — small enough to audit in an afternoon, which is the main mitigating factor. Support desk needs a script for "the company lookup isn't returning anything," because that will be the dominant ticket.
Scaling. The lookup is the scaling hazard, not the field. Every form interaction potentially triggers an outbound HTTP call; under load that becomes both a latency tax on our request workers and a load tax on a public, unpaid third-party service. Mitigations: debounce, cache aggressively by normalized CNPJ (company data changes rarely), and consider moving lookup off the submit path. Also watch database write volume if lookup results are persisted.
Failure modes.
Ramp-up. Low for engineers already fluent in Filament: roughly half a day to first working field, one to two days to a production-hardened integration with our own caching and failure policy. The larger organizational lift is not engineering — it is briefing support, data, and compliance stakeholders on the numeric-to-alphanumeric CNPJ transition so that downstream systems and validators are ready on the same timeline. That communication work should start alongside the pilot, not after rollout.
How can I help you explore Laravel packages today?