- How do I install jschaedl/iban-validation in a Laravel app?
- Install it with Composer 2 using composer require jschaedl/iban-validation. There is no service provider, facade, config file, or published assets to register, because the package is a framework-agnostic PHP library loaded through PSR-4 autoloading. After install, wrap it in your own validation rule or helper class so the third-party dependency stays out of controllers and Form Requests.
- Does this package ship a Laravel validation rule for IBAN?
- No. jschaedl/iban-validation is framework-agnostic and provides no Laravel service provider or built-in validation rule. The recommended integration is a thin adapter: a custom rule implementing Illuminate\Contracts\Validation\ValidationRule for Laravel 10+ (or a Rule object on older versions) that normalizes input and delegates to the library. That adapter is realistically about 30 lines including tests.
- Which PHP extensions does iban-validation require, such as bcmath or gmp?
- The mod-97 arithmetic depends on a big-number implementation, so confirm whether the package needs bcmath, gmp, or a polyfill by checking its composer.json requirements. This must be verified against every environment: local, CI, staging, production, and container base images. A missing extension turns a validation call into a fatal error rather than a clean validation failure, so resolve it before committing.
- Is jschaedl/iban-validation compatible with Laravel 10 and 11?
- Yes. The library has no Laravel version coupling, so it works with Laravel 9, 10, and 11 and will not constrain future framework upgrades. That is a real long-term advantage over Laravel-specific validation packages that pin framework versions. The only prerequisites are Composer 2 and a PHP build with the required math extension.
- What does this package actually validate, the IBAN format or the real bank account?
- It validates structural format and the mod-97 checksum defined by ISO 13616, nothing more. It does not confirm that the account exists, is open, or is reachable, and it does not perform BIC lookups or account-holder verification. Stakeholders frequently conflate checksum validation with account verification, so set expectations explicitly and keep those checks in application code.
- How do I create a custom Laravel validation rule using this IBAN library?
- Create a class implementing ValidationRule whose passes() method strips whitespace, uppercases the value, and delegates to the library's validator, returning a boolean. Register it as a rule object in your Form Request rules array, for example new ValidIban(). Keep normalization inside the adapter rather than scattered across call sites, and consider an Iban value object in the domain layer so the dependency stays swappable.
- How should I normalize IBAN input with spaces and lowercase before validating?
- The library correctly does not guess intent, so remove spaces and uppercase the value in your adapter before calling it. Users routinely paste IBANs in groups of four with lowercase letters, and failing to normalize produces false negatives. Document the normalization behavior once in the rule class so individual call sites never duplicate it.
- How do I test IBAN validation in Laravel with PHPUnit or Pest?
- Test against known-good and known-bad fixtures, since the ISO 13616 algorithm is deterministic and easy to assert on. Use a data provider covering valid IBANs from several countries, bad checksums, incorrect lengths, empty strings, and spaced or lowercase input to prove normalization works. The integration plus tests is roughly half a day of work, with no migrations, queues, or HTTP calls involved.
- Is jschaedl/iban-validation maintained and safe for production use?
- The code risk is low because the algorithm is a published ISO standard and testable against fixtures, but supply-chain risk is the dominant concern. The project has around 104 stars and appears to be a low-visibility, likely single-maintainer repository, so releases and any security patches arrive slowly. The MIT license mitigates abandonment: you can vendor the source or reimplement mod-97 in-house in under a day, so pin with a caret range and monitor.
- What are the alternatives to jschaedl/iban-validation for Laravel IBAN checks?
- Alternatives include other Composer IBAN validator packages, a small in-house mod-97 implementation, or an existing in-house validator you may already have, since duplication is a real cost. Also consider scope: if your product accepts non-IBAN accounts such as US ABA routing numbers or UK sort codes, this package covers only part of the surface. Treat it as replaceable infrastructure rather than a strategic component when choosing.