lekoala / tin

Provide validation tools for Taxpayer Identification Number
MIT License
6 stars 5 forks source link
php tin validator

Taxpayer Identification Number (TIN) Validator

Build Status Scrutinizer Code Quality Code Coverage Build Status codecov.io

Latest Stable Version Latest Unstable Version Total Downloads License Monthly Downloads Daily Downloads

Dependency Status Reference Status

You may want to use https://github.com/loophp/tin instead.

A library to validate TIN numbers for individuals. This is based on a java library, this is why the code does not reflect best practices in php.

Supported countries are:

If your country is not there, feel free to open an issue with your country code and a link to the specification. Ideally, if you can provide a PR with the algorithm and the test that would be even better :-)

Installation

Run

$ composer require lekoala/tin

Usage

To simply check the validity of a number

$result = TINValid::checkTIN($countryCode, $number);

If you want to get the reason why a number is invalid, you can use

try {
    TINValid::validateTIN($countryCode, $number);
}
catch(TINValidationException $e) {

}

If you want to see if a country is supported or not, you can simply use

$result = TINValid::isCountrySupported('be');

Links

[TIN Algorithms - Public - Functional Specification](<https://ec.europa.eu/taxation_customs/tin/specs/FS-TIN Algorithms-Public.docx>)

Taxpayer Identification Number

License

This package is licensed using the MIT License. Please have a look at LICENSE.md.