yoopies / tin
Provide validation tools for Taxpayer Identification Number
1.0.0
2026-11-10 15:07 UTC
Requires
- php: ^8.2
Requires (Dev)
- phpunit/phpunit: ^11.5
Suggests
None
Provides
None
Conflicts
None
Replaces
None
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