This package provides a custom validation rule for Laravel to validate International Bank Account Numbers (IBANs). It uses the validation rules defined by the Single Euro Payments Area (SEPA) and other non-SEPA countries to ensure that the given IBAN is valid.
PHP >= 8.1
Laravel >= 10
You can install this package using Composer:
composer require nembie/iban-rule
To use the IBAN validation rule, simply add it to your Laravel validation rules. Here's an example:
use Illuminate\Http\Request;
use Nembie\IbanRule\ValidIban;
public function store(Request $request)
{
$request->validate([
'iban' => ['required', new ValidIban()],
]);
// The rest of your code
}
You can use your own validation message (by default will be The :attribute is not a valid IBAN.
).
⚠️ If you don't have these folders usephp artisan lang:publish
Simply:
# Path
\main_folder_project
\lang
\app_language(ex.'en')
validation.php
# Add 'iban' key
<?php
// validation.php inside 'it' folder
'iban' => 'IBAN non valido.'
# Now you're validation message will be translated!
This package uses the validation rules defined by the Single Euro Payments Area (SEPA) and other non-SEPA countries to ensure that the given IBAN is valid. The validation rules are loaded from a countries.json
file that is included in this package.
If you find any issues or have suggestions for improvements, feel free to open a pull request or issue. Your contribution is highly appreciated.
Full list of supported countries
composer test
This package is open-sourced software licensed under the MIT license.