Search by

yoopies / tin

YoopiesDev

Provide validation tools for Taxpayer Identification Number

Package info

github.com/Yoopies/tin

pkg:composer/yoopies/tin

Statistics

Installs: 3 630

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

1.0.0 2026-11-10 15:07 UTC

This package is auto-updated.

Last update: 2026-11-10 15:08:26 UTC


README

Description

Based on https://github.com/loophp/tin, adapted for Yoopies.

Requirements

  • PHP 8.2 or higher

Usage

use Yoopies\Tin\TIN;
use Yoopies\Tin\Exception\TINException;

TIN::from('FR', '3023217600053')->isValid(); // true
TIN::fromSlug('FR3023217600053')->isValid(); // true
TIN::isCountrySupported('FR');               // true

// Non-alphanumeric characters (except '-' and '+') are stripped by default.
TIN::from('BE', '000125.111.19')->isValid();     // true
// Strict mode keeps them (the TIN is still uppercased).
TIN::from('BE', '000125.111.19')->isValid(true); // false

try {
    TIN::from('FR', '1111111111111')->check();
} catch (TINException $e) {
    echo $e->getMessage(); // Invalid TIN(1111111111111). Reason: Invalid syntax.
}

Tests

composer install
composer test