square-bit/laravel-pt-rules

Validation rules relevant to Portugal

v1.1 2021-03-15 10:10 UTC

This package is auto-updated.

Last update: 2021-09-15 11:17:38 UTC


README

Latest Stable Version License Total Downloads

This package provides a set of Rules for Laravel 8 that are mainly useful to validate Portuguese ... stuff .... such as NIFs and CCs.

Installation

Via Composer

$ composer require square-bit/laravel-pt-rules

Usage

Just like any other validation rule, simply add the desired class to the list of rules. Example:

return Validator::make($data, [
    [...]
    'nif' => ['required', new NIF()],
    [...]
]);

Available rules

Class Description
NIF Checks if the input is a valid Portuguese Fiscal ID number. Accepts both with and without the country preffix, ex: '123456789' or 'PT123456789'
BI Checks if the input is a valid Portuguese Identification Card number. (requires the entire number, including the last digit)
CC Checks if the input is a valid Portuguese Citizen Card number. (requires the full number, ex: "12233456 7 ZZ0")

Change log

Please see the changelog for more information on what has changed recently.

Contributing

Please see contributing.md for details and a todolist.

Security

If you discover any security related issues, please email info@square-bit.com instead of using the issue tracker.

Credits

License

MIT. Please see the license file for more information.