granitehldg/filament-iban-input
Filament IBAN Input
A Filament form field for IBAN (International Bank Account Number) input with real-time formatting, per-country length validation (ISO 13616), and mod-97 checksum verification.
Features
- Real-time formatting with country code dropdown
- Per-country IBAN length validation (ISO 13616, ~100 countries)
- Mod-97 checksum validation (can be disabled)
- Server-side + client-side (Alpine.js) validation
- Dark mode support, LTR-safe, copy-to-clipboard
- Works with Filament v3, v4 and v5
Requirements
- PHP
^8.2withext-bcmath - Laravel with Filament
^3.0 || ^4.0 || ^5.0
Installation
composer require granitehldg/filament-iban-input
The service provider is auto-discovered. No manual registration needed.
Optionally publish the views:
php artisan vendor:publish --tag=filament-iban-input-views
Usage
Basic usage
use Granite\FilamentIban\Forms\Components\IbanInput;
IbanInput::make('iban')
->label('Bank Account (IBAN)')
->required();
Limit countries
IbanInput::make('iban')
->countries(['DE', 'FR', 'NL', 'GB'])
->defaultCountry('DE')
->required();
Accept all IBAN countries
By default only ['UA', 'EG', 'DE', 'GB', 'FR', 'NL'] are offered. To accept any known ISO 13616 country:
IbanInput::make('iban')
->allCountries()
->required();
Disable checksum validation
IbanInput::make('iban')
->validateChecksum(false) // format/length only
->required();
Custom lengths
IbanInput::make('iban')
->countries(['ZZ'])
->countryLengths(['ZZ' => 6])
->validateChecksum(false);
The component stores the complete IBAN as a single string, e.g. DE89370400440532013000.
Helpers
use Granite\FilamentIban\Forms\Components\IbanInput;
IbanInput::validateIbanChecksum('DE89370400440532013000'); // true
IbanInput::normalize('de89 3704 0044 0532 0130 00'); // DE89370400440532013000
See USAGE_EXAMPLE.md for migrations, models, and advanced validation examples.
Validation
Server-side validation checks, in order:
- Country code is 2 letters and (unless
allCountries()) in the allowed list - Two numeric check digits after the country code
- Body length matches the per-country ISO 13616 length
- Mod-97 checksum equals
1(unless disabled)
Empty values pass through so ->required() / ->nullable() behave as expected.
Testing
composer install
vendor/bin/phpunit
Valid IBANs for manual testing:
DE89370400440532013000GB29NWBK60161331926819FR1420041010050500013M02606NL91ABNA0417164300UA213223130000026007233566001
Building assets
npm install
npm run build
This compiles resources/css/index.css to resources/dist/filament-iban-input.css. Commit the built file before tagging a release.
Changelog
See CHANGELOG.md for release notes. Follow SemVer: tagged releases (v4.1.0, ...) are what Packagist publishes.
Contributing
Issues and PRs are welcome. Please run tests before submitting.
Security
If you discover a security issue, please email the maintainers privately instead of opening a public issue.
Credits
Developed by Granite Holding.
License
MIT. See LICENSE.
Related Packages
Automatic form saving for Filament with a visual status indicator, undo, and dra...
Column-by-column autosave for Filament forms: nothing is lost on a closed tab, t...
A character counter for the TextInput, Textarea and RichEditor fields of Filamen...
Version History
| Version | Released | PHP | License |
|---|---|---|---|
| v5.0.1 | ^8.2 | MIT | |
| v5.0.0 | ^8.2 | MIT | |
| v4.1.0 | ^8.2 | MIT | |
| v4.0.0 | ^8.2 | MIT |