PHPackages                             vldmir/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. vldmir/tin

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

vldmir/tin
==========

Enhanced Taxpayer Identification Number validator with input masks (fork of loophp/tin)

3.0.4(3mo ago)1340↓50%[2 PRs](https://github.com/vldmir/tin/pulls)MITPHPPHP &gt;= 8.1

Since Jul 26Pushed 3mo agoCompare

[ Source](https://github.com/vldmir/tin)[ Packagist](https://packagist.org/packages/vldmir/tin)[ Docs](https://github.com/vldmir/tin)[ GitHub Sponsors](https://github.com/drupol)[ RSS](/packages/vldmir-tin/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (6)Versions (31)Used By (0)

[![Latest Stable Version](https://camo.githubusercontent.com/457a95fed94f0d5ac67fe9ee4efe53370c6e2f811c836ddd0c9b420fe7c6475c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f766c646d69722f74696e2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/vldmir/tin)[![GitHub stars](https://camo.githubusercontent.com/421a3953ba1f48b643c466c56d8439b629c36e66a75ecb2322d3372bb878af76/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73746172732f766c646d69722f74696e2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/vldmir/tin)[![Total Downloads](https://camo.githubusercontent.com/db7798bad64edc4ba458dd9f8aa97662b6910ae72a459c6d0e7ad72f53424040/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f766c646d69722f74696e2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/vldmir/tin)[![GitHub Workflow Status](https://camo.githubusercontent.com/21ae5c4c8b1f00609f70dc2cb29509c017b9b8a76c75a48a8adc1b84e7fb1176/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f766c646d69722f74696e2f74657374732e796d6c3f6272616e63683d6d6173746572267374796c653d666c61742d737175617265)](https://github.com/vldmir/tin/actions)[![Type Coverage](https://camo.githubusercontent.com/71b75462eadf76ada0a63070f01a8c7b2e71bd8324d4fb3393d8b2d6587fa6c2/68747470733a2f2f73686570686572642e6465762f6769746875622f766c646d69722f74696e2f636f7665726167652e737667)](https://shepherd.dev/github/vldmir/tin)[![License](https://camo.githubusercontent.com/b21259a89dc1c1df0c08688a4b93ba7de9483e318fd4dd08c522b6ee5ab7f45e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f766c646d69722f74696e2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/vldmir/tin)

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

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

Description
-----------

[](#description)

An enhanced library to validate TIN numbers for individuals with advanced features including input masks, TIN type identification, and comprehensive Docker support. This is a fork of the original loophp/tin library with significant enhancements.

**New Features in v2.0.0:**

- 🎯 **Input Mask Support** - Get format masks for TIN input fields
- 📝 **Placeholder Generation** - Generate example values for input fields
- 🔧 **Input Formatting** - Format user input according to TIN mask
- 🏷️ **TIN Type Identification** - Identify specific TIN types (DNI, NIE, CIF, etc.)
- 📊 **TIN Types API** - Get available TIN types for each country
- 🐳 **Docker Support** - Complete development environment with PHP 8.3
- 📚 **Enhanced Documentation** - Comprehensive examples and usage guides

Supported countries:

- Austria (AT)
- Belgium (BE)
- Bulgaria (BG)
- Croatia (HR)
- Cyprus (CY)
- Czech Republic (CZ)
- 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)
- Slovenia (SI)
- [Spain (ES)](docs/TIN-Country_Sheet_ES.md)
- 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, you can provide a pull request with the algorithm and the tests.

Requirements
------------

[](#requirements)

- PHP &gt;= 8.1

Quick Start
-----------

[](#quick-start)

### Installation

[](#installation)

```
composer require vldmir/tin
```

### Basic Validation

[](#basic-validation)

To simply check the validity of a TIN number:

```
