rocketfellows/es-vat-format-validator

v1.0.0 2023-04-07 15:22 UTC

This package is auto-updated.

Last update: 2024-12-07 19:12:37 UTC


README

Code Coverage Badge

This component provides Spain 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/es-vat-format-validator

Usage example

Valid Spain vat number:

$validator = new ESVatFormatValidator();
$validator->isValid('ESX12345678');
$validator->isValid('ES12345678X');
$validator->isValid('ESX1234567X');
$validator->isValid('12345678X');
$validator->isValid('X12345678');
$validator->isValid('X1234567X');

Returns:

true
true
true
true
true
true

Invalid Spain vat number:

$validator = new ESVatFormatValidator();
$validator->isValid('ES123456789');
$validator->isValid('ES12345678XX');
$validator->isValid('ES1234567X');
$validator->isValid('ESX123456789');
$validator->isValid('ESX1234567');
$validator->isValid('ESXX1234567');
$validator->isValid('ESX1234');
$validator->isValid('ESX12345678X');
$validator->isValid('ESX1234567XX');
$validator->isValid('ESXX1234567X');
$validator->isValid('DE12345678X');
$validator->isValid('DEX12345678');
$validator->isValid('DEX1234567X');
$validator->isValid('12345678XX');
$validator->isValid('123456789X');
$validator->isValid('1234567X');
$validator->isValid('X123456789');
$validator->isValid('X1234567');
$validator->isValid('X12345679X');
$validator->isValid('X123456X');
$validator->isValid('123456789');
$validator->isValid('12345678');
$validator->isValid('1234567890');
$validator->isValid('');
false
false
false
false
false
false
false
false
false
false
false
false
false
false
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.