sllh/iso-codes-validator
Adds Laravel validation rules for ISO standards, letting you verify country, language, currency, and other ISO codes in forms and APIs. Integrates seamlessly with existing validators to keep input standards-compliant and clean, with support for common ISO formats.
Architecture fit. The package is a thin Symfony-validation wrapper around ronanguilloux/IsoCodes: it adds Constraint + Validator pairs (country codes, language codes, IBAN/BIC, credit card, phone, etc.) that delegate to the upstream lookup library. It is not Laravel-native — Laravel's Illuminate\Validation pipeline does not consume Symfony Constraint objects. The package's own surface area is small; most of the domain logic and data live upstream. That is good for auditability and bad for leverage inside a Laravel app.
Integration feasibility. Technically possible but awkward. Two viable paths:
symfony/validator alongside the package and invoke constraints outside Laravel's validator — fights the framework and duplicates error handling.ronanguilloux/IsoCodes directly and wrap it in a custom Laravel ValidationRule. Simpler, fewer moving parts, no Symfony validator dependency.Path 2 is the pragmatic choice for a Laravel-first stack. In that case the package evaluates as reference implementation and data vocabulary, not a runtime dependency.
Technical risk.
symfony/validator version pins can collide with the Symfony components Laravel already pulls, becoming a recurring tax on framework upgrades.composer.json before committing.Key questions.
IsoCodes refresh its datasets, and what is its release history?Stack fit. Treat the package as a Symfony-ecosystem artifact, not a Laravel dependency. Fit is best where the team already uses Symfony constraints directly; for a standard Laravel app it is a foreign component with no framework-level integration.
Migration path.
ValidationRule classes (e.g., IsoCountry, Iban, IsoLanguage) that call the IsoCodes static methods (or the package's validator classes) and return Laravel-native Validator messages. This keeps controllers and Form Requests clean and framework-idiomatic.Compatibility. Confirm PHP constraint against our runtime, and confirm whether symfony/validator is needed at all under the adapter approach (preferably not). Translation strings are Symfony-style; map them into Laravel lang files so UX stays consistent and localized.
Sequencing. Start with low-blast-radius fields — country and language selectors — where a false rejection is a UX annoyance, not a compliance event. Move next to banking identifiers (IBAN/BIC), where correctness matters most and where we should pair the library with checksum verification and a golden test set. Defer phone validation; libphonenumber derivatives are a better-supported choice and mixing the two invites inconsistent behavior. Maintain a fixture suite of valid/invalid values per constraint and run it on every framework or dependency upgrade.
Maintenance. The dominant cost is ownership, not integration. With no dependents and a small community, expect to (a) monitor upstream for data updates and (b) absorb deprecation and version-pin work ourselves. Budget a small recurring allocation — roughly a day per framework upgrade cycle and a periodic review of dataset currency — plus a contingency for forking or vendoring.
Support. No commercial support and limited community answers. Internal documentation (supported constraints, message keys, known gaps) and a named owner are prerequisites; otherwise knowledge concentrates in the one engineer who did the spike.
Scaling. Negligible infrastructure impact. Validation is CPU-cheap, data is in-memory static arrays, and throughput of a typical Laravel API will not be constrained. No caching architecture required; at most, avoid constructing constraint objects per request in hot paths. Horizontal scaling is unaffected.
Failure modes.
Ramp-up. Low for engineers already comfortable with Laravel validation; moderate for anyone who must reason about Symfony Constraint/Validator internals. Mitigate by shipping the adapter and fixture suite as the team's interface, documenting coverage and known limitations, and gating adoption on a short internal demo. Overall: adopt selectively where the data is genuinely hard to maintain in-house (IBAN, ISO country/language), avoid for phone, and keep the abstraction thin so the decision stays reversible.
How can I help you explore Laravel packages today?