- How do I install globalcitizen/php-iban in a Laravel application?
- Run composer require globalcitizen/php-iban. There is no Laravel service provider or auto-discovery step to configure; after installation, use the library's IBAN class in a custom rule, service, or job. Commit composer.lock and deploy as usual.
- Does globalcitizen/php-iban provide a native Laravel validation rule?
- No. It is a framework-agnostic PHP library, not a Laravel package with a service provider or built-in FormRequest rule. You integrate it by creating a custom Laravel validation rule, closure, or dedicated validator service that calls the library. This keeps Laravel's validation messages and request flow under your control.
- How do I validate an IBAN in a Laravel FormRequest?
- Create a custom rule or closure that instantiates the library's IBAN class with the submitted value, normalizes human formatting if needed, and checks validity. Add that rule to your FormRequest rules array alongside required and string constraints. Return a clear validation message and log or flag invalid values for review when they affect payments.
- Which PHP and Laravel versions are supported?
- The library is framework-agnostic, so Laravel compatibility follows your PHP version rather than a Laravel service provider constraint. Current integration guidance targets PHP 8.0+ and Laravel 8+, with the v4.2.3 deprecation fix being non-breaking. Check Packagist and the repository for exact PHP constraints before upgrading legacy applications.
- Can php-iban parse bank, branch, and account details from an IBAN?
- Yes. It can extract the country code, checksum, BBAN, bank or financial institution code, account number, and branch or sort code where the national format uses fixed-length components. It can also validate and set legacy national checksums where available. Treat parsed fields as format-derived metadata and confirm them against your banking provider.
- How should I store and display IBANs in a Laravel app?
- Store the machine representation without spaces in a database column sized VARCHAR(34) or larger to avoid truncation. Use the library's human representation for display and its obfuscation support when you need partial identification. Normalize input before validation and never rely on presentation formatting for equality checks.
- Can php-iban suggest corrections for mistyped IBANs?
- Yes. The library can produce highly accurate suggestions for the originally intended input when an invalid IBAN appears to result from mistranscription. Use these suggestions as user-facing hints or review prompts rather than silently changing financial data. Always require confirmation before replacing a stored IBAN.
- Does it support all countries and the latest SWIFT IBAN registry?
- It supports a broad set of IBAN countries and IIBAN formats based on the official SWIFT registry, with manual fixes for known specification issues. The README notes the registry changes frequently, so a newer SWIFT release may not be reflected immediately. Verify critical country formats and monitor package updates if you operate across many regions.
- Can I use php-iban to generate test IBANs for Laravel tests?
- Yes. The package includes a database of example and test IBANs from different countries and supports generation-related use cases. Use these values in unit and feature tests for valid, invalid, and mistyped inputs. Keep test data clearly labeled and avoid using real customer account numbers in test suites.
- Is globalcitizen/php-iban suitable for production payment and payout flows?
- It is a suitable validation, parsing, and formatting utility for production Laravel systems, and its LGPL license permits commercial use. It is stateless, so it does not introduce shared-write thread-safety concerns, but it does not replace payment-provider validation or compliance controls. For high-risk transfers, combine it with manual review, audit logging, caching or queues for bulk checks, and tests using real-world IBAN vectors.