rocketfellows/nl-vat-format-validator

v1.0.0 2023-03-22 19:40 UTC

This package is not auto-updated.

Last update: 2024-12-27 02:20:24 UTC


README

Code Coverage Badge

This component provides Netherlands vat number format validator.

Implementation of interface rocketfellows\CountryVatFormatValidatorInterface\CountryVatFormatValidatorInterface

Depends on https://github.com/rocketfellows/country-vat-format-validator-interface

Installation

composer require rocketfellows/nl-vat-format-validator

Usage example

Valid Netherlands vat number:

$validator = new NLVatFormatValidator();
$validator->isValid('NL123456789B01');
$validator->isValid('NL123456789BO2');
$validator->isValid('123456789B01');
$validator->isValid('123456789BO2');

Returns:

true
true
true
true

Invalid Netherlands vat number:

$validator = new NLVatFormatValidator();
$validator->isValid('NL12345678B01');
$validator->isValid('NL1234567890B01');
$validator->isValid('NL123456789B011');
$validator->isValid('NL123456789B011');
$validator->isValid('1234567890B01');
$validator->isValid('12345678B01');
$validator->isValid('NL1234567890BO2');
$validator->isValid('NL123456789BA2');
$validator->isValid('1234567890BO2');
$validator->isValid('');
false
false
false
false
false
false
false
false
false
false

Contributing

Welcome to pull requests. If there is a major changes, first please open an issue for discussion.

Please make sure to update tests as appropriate.