PHPackages                             lekoala/tin - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Validation &amp; Sanitization](/categories/validation)
4. /
5. lekoala/tin

ActiveLibrary[Validation &amp; Sanitization](/categories/validation)

lekoala/tin
===========

Provide validation tools for Taxpayer Identification Number

1.3(6y ago)614.2k2[1 issues](https://github.com/lekoala/tin/issues)MITPHPPHP ^7.1CI failing

Since Mar 5Pushed 3mo ago1 watchersCompare

[ Source](https://github.com/lekoala/tin)[ Packagist](https://packagist.org/packages/lekoala/tin)[ Docs](https://github.com/lekoala/tin)[ RSS](/packages/lekoala-tin/feed)WikiDiscussions master Synced 6d ago

READMEChangelog (4)Dependencies (2)Versions (5)Used By (0)

Taxpayer Identification Number (TIN) Validator
==============================================

[](#taxpayer-identification-number-tin-validator)

[![Build Status](https://camo.githubusercontent.com/c513ad654b63829b677bff1a9920e36a2d3e4c614a5c95bd129e440e6cb85ca6/68747470733a2f2f7472617669732d63692e6f72672f6c656b6f616c612f74696e2e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/lekoala/tin)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/9ebf97e83d89924cb1a3ad64ff93b5502a64d0a91f8eab1711b2d885282693ee/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6c656b6f616c612f74696e2f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/lekoala/tin/?branch=master)[![Code Coverage](https://camo.githubusercontent.com/034141b7156f65fc7982a981e5b537ddf15a12b58857428955fc250453d485e2/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6c656b6f616c612f74696e2f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/lekoala/tin/?branch=master)[![Build Status](https://camo.githubusercontent.com/4a52a2fdaad86f682342e5340763460389a2b6eb4fff0846ca0a19353bc9cc2e/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6c656b6f616c612f74696e2f6261646765732f6275696c642e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/lekoala/tin/build-status/master)[![codecov.io](https://camo.githubusercontent.com/66e81d2ec448980375bf5c0215d8b419fe32832cb0846cde3eda1d363df60113/68747470733a2f2f636f6465636f762e696f2f6769746875622f6c656b6f616c612f74696e2f636f7665726167652e7376673f6272616e63683d6d6173746572)](https://codecov.io/github/lekoala/tin?branch=master)

[![Latest Stable Version](https://camo.githubusercontent.com/5e32e28afa78aa3291c8f3e2eda659c410539b5f4dd1d3b2568ae988283f674c/68747470733a2f2f706f7365722e707567782e6f72672f6c656b6f616c612f74696e2f76657273696f6e)](https://packagist.org/packages/lekoala/tin)[![Latest Unstable Version](https://camo.githubusercontent.com/bfea6502ad126b68169250287039c7faf1d0205b56ee48c4a2993eca1a1991cb/68747470733a2f2f706f7365722e707567782e6f72672f6c656b6f616c612f74696e2f762f756e737461626c65)](//packagist.org/packages/lekoala/tin)[![Total Downloads](https://camo.githubusercontent.com/2f8775443e124d2483f24140a8961076427f1c8bce1ab219d2cd2ec47d6cac33/68747470733a2f2f706f7365722e707567782e6f72672f6c656b6f616c612f74696e2f646f776e6c6f616473)](https://packagist.org/packages/lekoala/tin)[![License](https://camo.githubusercontent.com/eae3d62a3fcbab95fa8caeec142533d0a4b84e1c45d707ed3e2e3612de554186/68747470733a2f2f706f7365722e707567782e6f72672f6c656b6f616c612f74696e2f6c6963656e7365)](https://packagist.org/packages/lekoala/tin)[![Monthly Downloads](https://camo.githubusercontent.com/ae56ff2952539bd081807e024ddb05bc1fefd782a8c5cd3a3b2154b94ef90988/68747470733a2f2f706f7365722e707567782e6f72672f6c656b6f616c612f74696e2f642f6d6f6e74686c79)](https://packagist.org/packages/lekoala/tin)[![Daily Downloads](https://camo.githubusercontent.com/b3db117e815ca8654da573b1ec71f24e8d1964dec7a50d251523fbe289d69eb2/68747470733a2f2f706f7365722e707567782e6f72672f6c656b6f616c612f74696e2f642f6461696c79)](https://packagist.org/packages/lekoala/tin)

[![Dependency Status](https://camo.githubusercontent.com/ece3d91caacc9bfb9d95408fcc479b6f9e451fd304e6282085f549d627bb8219/68747470733a2f2f7777772e76657273696f6e6579652e636f6d2f7068702f6c656b6f616c613a74696e2f62616467652e737667)](https://www.versioneye.com/php/lekoala:tin)[![Reference Status](https://camo.githubusercontent.com/bf4b7aa1a1991c1b9e63fe00316fdc3d1fe85f60c6dc9cb1ae7b247524b57206/68747470733a2f2f7777772e76657273696f6e6579652e636f6d2f7068702f6c656b6f616c613a74696e2f7265666572656e63655f62616467652e7376673f7374796c653d666c6174)](https://www.versioneye.com/php/lekoala:tin/references)

You may want to use  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:

- Austria (AT)
- Belgium (BE)
- Bulgaria (BG)
- Croatia (HR)
- Cyprus (CY)
- Czech Republic (CZ) - no check digit (but possible czechphp/national-identification-number-validator)
- Denmark (DK)
- Estonia (EE)
- Finland (FI)
- France (FR)
- Germany (DE)
- Greece (GR) - only size
- Hungary (HU)
- Ireland (IE)
- Italy (IT)
- Latvia (LV) - no check digit
- Lithuania (LT)
- Luxembourg (LU)
- Malta (MT) - no check digit
- Netherlands (NL)
- Poland (PL)
- Portugal (PT)
- Romania (RO) - no check digit
- Slovakia (SK) - only structure
- Slovenia (SI)
- Spain (ES)
- Sweden (SE)
- United Kingdom (UK) - only structure

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
------------

[](#installation)

Run

```
$ composer require lekoala/tin

```

Usage
-----

[](#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
-----

[](#links)

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

[`Taxpayer Identification Number`](https://en.wikipedia.org/wiki/Taxpayer_Identification_Number)

License
-------

[](#license)

This package is licensed using the MIT License. Please have a look at [`LICENSE.md`](LICENSE.md).

###  Health Score

38

—

LowBetter than 85% of packages

Maintenance50

Moderate activity, may be stable

Popularity26

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity54

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 78.3% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~8 days

Total

4

Last Release

2239d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/250762?v=4)[Thomas Portelange](/maintainers/lekoala)[@lekoala](https://github.com/lekoala)

---

Top Contributors

[![lekoala](https://avatars.githubusercontent.com/u/250762?v=4)](https://github.com/lekoala "lekoala (18 commits)")[![ordago](https://avatars.githubusercontent.com/u/6376814?v=4)](https://github.com/ordago "ordago (5 commits)")

---

Tags

phptinvalidator

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/lekoala-tin/health.svg)

```
[![Health](https://phpackages.com/badges/lekoala-tin/health.svg)](https://phpackages.com/packages/lekoala-tin)
```

###  Alternatives

[webmozart/assert

Assertions to validate method input/output with nice error messages.

7.6k894.0M1.2k](/packages/webmozart-assert)[bensampo/laravel-enum

Simple, extensible and powerful enumeration implementation for Laravel.

2.0k15.9M104](/packages/bensampo-laravel-enum)[swaggest/json-schema

High definition PHP structures with JSON-schema based validation

48612.5M73](/packages/swaggest-json-schema)[stevebauman/purify

An HTML Purifier / Sanitizer for Laravel

5325.6M19](/packages/stevebauman-purify)[ashallendesign/laravel-config-validator

A package for validating your Laravel app's config.

217905.3k5](/packages/ashallendesign-laravel-config-validator)[crazybooot/base64-validation

Laravel validators for base64 encoded files

1341.9M8](/packages/crazybooot-base64-validation)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
