rocketfellows/ro-vat-format-validator

v1.0.0 2023-03-31 19:19 UTC

This package is not auto-updated.

Last update: 2024-10-27 00:51:44 UTC


README

Code Coverage Badge

This component provides Romania 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/ro-vat-format-validator

Usage example

Valid Romania vat number:

$validator = new ROVatFormatValidator();
$validator->isValid('RO12');
$validator->isValid('RO123');
$validator->isValid('RO1234');
$validator->isValid('RO12345');
$validator->isValid('RO123456');
$validator->isValid('RO1234567');
$validator->isValid('RO12345678');
$validator->isValid('RO123456789');
$validator->isValid('RO1234567890');
$validator->isValid('12');
$validator->isValid('123');
$validator->isValid('1234');
$validator->isValid('12345');
$validator->isValid('123456');
$validator->isValid('1234567');
$validator->isValid('12345678');
$validator->isValid('123456789');
$validator->isValid('1234567890');

Returns:

true
true
true
true
true
true
true
true
true
true
true
true
true
true
true
true
true
true

Invalid Romania vat number:

$validator = new ROVatFormatValidator();
$validator->isValid('RO1');
$validator->isValid('1');
$validator->isValid('RO12345678901');
$validator->isValid('12345678901');
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.