Using Laravel's validator.
- PHP >= 7.1
- Laravel >= 5.5, 6.0, 7.0 or 8.0
Install the package via Composer:
$ composer require daandevos/laravel-dutch-license-number-validation
You can use the Dutch license number validation as any other validation rule:
<?php
$request->validate([
'license_number' => 'required|string|dutch_license_number',
]);
Optionally you can change the validation error message by adding an entry to the validation language file:
'dutch_license_number' => 'The Dutch license number format is invalid.',
'uuid' => 'The :attribute must be a valid UUID.',
// ...
The allowed input may vary between license plate numbers with and without minus between the numbers or letters. Also, the validation is not case sensitive. To give you an idea of which formats are allowed:
✅ 99-XX-XX ✅ 99XXXX ✅ 99--XX--XX
Before processing the input, you may want to format the license plate number to you own format.
If you discover a security vulnerability within this package, please send an e-mail to Daan de Vos via daan@devos.id. All security vulnerabilities will be promptly addressed.
This package is open-sourced software licensed under the MIT license.