- How do I install ronanguilloux/isocodes in a Laravel app?
- Install it with Composer using composer require ronanguilloux/isocodes and pin an explicit version in composer.json. It is PSR-4 autoloaded and has no framework dependencies, so no service provider is mandatory. If you need configuration or bindings, register a thin service provider in your app. Route usage through your own adapter classes rather than calling the static validators directly.
- Does ronanguilloux/isocodes provide native Laravel validation rules for form requests?
- No, the library exposes static validator methods that return booleans, not Laravel Rule objects or validation messages. You should wrap the validators in custom Rule classes such as IbanRule, CountryCodeRule, or PhoneRule. This keeps your controllers and form requests depending on Laravel's validation contract instead of the third-party API. Add translation-aware failure messages so users understand why validation failed.
- What ISO standards and identifier types does ronanguilloux/isocodes validate?
- The library covers ISO 3166-1 country codes, ISO 3166-2 subdivisions, ISO 4217 currencies, and ISO 639 languages. It also includes validators for financial identifiers such as IBAN and BIC, plus GS1, public administration codes, phone numbers, and postal codes for many countries. It provides validation helpers and easy data access for dropdowns and locale-aware forms. Check the exact validator list against your specific use case before adopting it.
- Is ronanguilloux/isocodes compatible with PHP 8 and modern Laravel versions?
- The package is broadly reported as compatible with PHP 8.x and is Composer-installable, but you should verify its constraints against your runtime and existing dependencies. Laravel itself does not require any special integration beyond wrapping the validators in custom rules. Check whether any validators rely on PHP extensions such as intl or mbstring that may not be in your build image. Pin the package version rather than floating it to avoid unexpected changes.
- What license does ronanguilloux/isocodes use, and can I use it in a commercial Laravel product?
- The package is reported as GPL-3.0, which is a copyleft license and a significant adoption risk for proprietary or distributed Laravel applications. Depending on how the library is linked or derived into your product, GPL obligations may extend to the distributed application. This requires legal review before adoption and is a likely blocker in many commercial contexts. If GPL-3.0 is unacceptable, evaluate narrower permissively licensed alternatives for the specific validators you need.
- Is ronanguilloux/isocodes still maintained, and how current is its standards data?
- The last release was June 2023 and the repository status has been reported as unknown, so active maintenance is uncertain. Standards data such as ISO country codes, IBAN structures, phone numbering, and postal codes drifts over time, and stale validators can reject valid input or accept invalid input. Because rules are encoded as code, correcting drift requires upstream releases or local patching. In a long-lived Laravel app, plan for fork liability or isolate the dependency behind your own interface.
- How do I validate an IBAN or BIC in Laravel using this package?
- Call the library's IBAN and BIC static validators inside a custom Laravel Rule class, then use that rule in form requests or API request validation. Keep all direct calls to the library in that adapter layer so controllers, jobs, and models never depend on the third-party API. Backfill tests with known-good and known-bad IBAN and BIC fixtures per country to catch false negatives. Consider user-friendly messages because a rejected-but-valid IBAN creates customer friction.
- Can I use ronanguilloux/isocodes to populate country, currency, subdivision, and language dropdowns?
- Yes, the library is designed for easy data access to ISO 3166-1 countries, 3166-2 subdivisions, 4217 currencies, and 639 languages. You can read these lists through a thin service or adapter and expose them to Blade views or API endpoints. Avoid calling the library directly from views or controllers if you want the dependency to remain replaceable. Cache or precompute the lists if they are used frequently in forms.
- How should I test ronanguilloux/isocodes validators in a Laravel application?
- Test through your own Rule classes and adapter services rather than testing the library internals. Use known-good and known-bad fixtures for each validator, especially for IBAN, BIC, phone, and postal code rules where country-specific edge cases matter. Add false-negative tests for valid values that look unusual, because rejecting valid customer input has real business cost. This approach also lets you swap the underlying library later without rewriting domain tests.
- What are the alternatives to ronanguilloux/isocodes for validation in Laravel?
- Alternatives include narrower, permissively licensed packages for specific needs such as IBAN validation, phone number parsing, or ISO country and currency lists. Some Laravel-focused packages provide ready-made validation rules and up-to-date data. The right choice depends on which validators you actually need and whether GPL-3.0 is acceptable for your distribution model. Isolate the dependency behind your own validation interface so switching later does not touch domain code.