daandevos / laravel-dutch-license-number-validation
Validate a Dutch license plate number
Requires
- php: ^8.0
- ext-json: *
- illuminate/support: ~8.0 | ^9.0 | ^10.0 | ^11.0
README
Using Laravel's validator.
Requirements
- PHP >= 7.1
- Laravel >= 5.5, 6.0, 7.0 or 8.0
Installation
Install the package via Composer:
$ composer require daandevos/laravel-dutch-license-number-validation
Usage
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.', // ...
Notice
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.
Security Vulnerabilities
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.
License
This package is open-sourced software licensed under the MIT license.