nwidart/laravel-normalizer
A Laravel package for normalizing data into consistent, predictable formats. Define custom normalizers to clean and transform input, making validation and storage simpler across your application.
Naming the problem: where input consistency gets decided. This package exists because raw input — form payloads, webhook bodies, CSV imports, model attributes — arrives in inconsistent shapes, and someone has to decide where in the stack that inconsistency is resolved. That is a real product decision with visible consequences: validation error rates, duplicate records from import flows, and support tickets that read "the integration worked for one customer but not the other." The package is a reference answer (normalize at the boundary, before validation and persistence), not necessarily the implementation you ship.
Build vs. buy — and here the answer is "build, informed by the buy." With 12 stars, a single maintainer, and a last release of 2016-07-27, the vendor-risk side of this equation is settled. But the design side is cheap and reusable: a centralization layer for this scope is typically a few hundred lines and roughly a day of engineering. The defensible PM call is to treat the package as prior art — read the API, copy the mental model, own the code. That converts a dependency decision into a small, bounded engineering task with no supply-chain exposure.
Architecture decision with product consequences. Choose explicitly between (a) normalizing at the edge in middleware/form requests, (b) normalizing per-consumer inside services, or (c) normalizing at persistence via model casts. Option (a) gives uniform downstream contracts and cheaper validation; it also concentrates risk if the rules are wrong. This belongs in an ADR, not in five controllers doing trim() and strtolower() independently.
Use-case fit. Genuinely relevant to: partner/third-party ingestion where payload shapes drift per sender, bulk import and onboarding flows, multi-tenant configuration where the same key arrives as "true", 1, and true, and migration/backfill scripts reading heterogeneous legacy data. Not relevant to: greenfield APIs you fully control (define the schema once, validate it, move on).
Roadmap and risk-register line item. If any team proposes adding it, the roadmap entry is not "feature enablement" — it is a tech-debt and maintenance line. Track it as such, with an explicit owner and an exit condition, so it does not quietly become load-bearing infrastructure nobody has looked at since 2016.
Effort/priority framing for triage. A normalization layer is unglamorous and never appears on a customer-facing roadmap, but it is a common root cause of data-quality defects that do appear there. Budget it as reliability work, scoped to the flows that actually have heterogeneous inputs, rather than as a blanket platform investment.
Consider it when:
illuminate/* constraints may still resolve, and you want a small, MIT-licensed reference implementation rather than a new build.Look elsewhere — or write it yourself — when:
spatie/laravel-data, Symfony Serializer, Laravel's FormRequest::prepareForValidation plus Arr:: helpers, or plain model casts, all of which are actively maintained and already in your dependency tree.For executives: A team may propose this package to standardize messy inbound data — webhooks, imports, partner payloads. The problem is real; this specific package is not the answer. It has 12 stars, one maintainer, and no release since July 2016, which means no security response, no framework compatibility with anything we run today, and no one accountable if it breaks. The good news is that the underlying capability is small — on the order of a day of engineering for the flows we actually care about. Recommendation: read it as prior art, build the normalization layer in-house, and put the day of work against the import and integration flows where inconsistent data is provably costing us. This is a low-cost reliability decision, not a platform bet, and it carries no vendor dependency.
For engineering: Treat 0.2 as a reference implementation, not a dependency. If you install it, expect Composer constraint conflicts against modern illuminate/* versions and a hard PHP 7-era baseline; the scalar type hints in 0.2 also mean loose-typing call sites and subclasses will fail at runtime with TypeError or signature errors rather than at install time. The recommended path is a thin internal normalizer — a small set of named transformers applied in middleware or a form request's prepareForValidation, covered by table-driven tests with real-world sample payloads. That gives us identical behavior, a modern runtime, a test suite, and an owner. If someone does want the package itself, require a named maintainer, a pinned version, a fork under our org, and an exit condition before it merges.
How can I help you explore Laravel packages today?