PHPackages                             guanting112/php-taiwan-id-validator - 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. guanting112/php-taiwan-id-validator

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

guanting112/php-taiwan-id-validator
===================================

Taiwan ID Validator (National ID, ARC, UBN) for PHP

v1.0.0(5mo ago)171MITPHPPHP ^8.0CI passing

Since Jan 11Pushed 5mo agoCompare

[ Source](https://github.com/guanting112/php-taiwan-id-validator)[ Packagist](https://packagist.org/packages/guanting112/php-taiwan-id-validator)[ RSS](/packages/guanting112-php-taiwan-id-validator/feed)WikiDiscussions main Synced today

READMEChangelog (1)Dependencies (1)Versions (2)Used By (0)

Taiwan ID Validator (for PHP)
=============================

[](#taiwan-id-validator-for-php)

[![PHP Test](https://github.com/guanting112/php-taiwan-id-validator/actions/workflows/php.yml/badge.svg)](https://github.com/guanting112/php-taiwan-id-validator/actions/workflows/php.yml)[![License: MIT](https://camo.githubusercontent.com/fdf2982b9f5d7489dcf44570e714e3a15fce6253e0cc6b5aa61a075aac2ff71b/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d79656c6c6f772e737667)](https://opensource.org/licenses/MIT)

A lightweight, zero-dependency PHP package for validating Taiwan National IDs, Alien Resident Certificates (ARC), and Unified Business Numbers (UBN).

Other Implementations
---------------------

[](#other-implementations)

- [Golang](https://github.com/guanting112/taiwan-id-validator)
- [Ruby](https://github.com/guanting112/taiwan-id-validator-ruby)

Features
--------

[](#features)

- **Taiwan National ID** (中華民國身分證字號)
- **New Alien Resident Certificate** (新式外來人口統一證號) (Since 2021)
- **Old Alien Resident Certificate** (舊式外來人口統一證號)
- **Unified Business Number (UBN)**: Validates company tax IDs (統一編號), fully supporting the logic (including the 7th-digit rule).

Installation
------------

[](#installation)

Install via Composer:

```
composer require guanting112/php-taiwan-id-validator
```

Usage
-----

[](#usage)

```
use TaiwanIdValidator\TaiwanIdValidator;

// General Validation (National ID or ARC)
TaiwanIdValidator::validate('A123456789'); // true (National ID)
TaiwanIdValidator::validate('A800000014'); // true (New ARC)
TaiwanIdValidator::validate('AC01234567'); // true (Old ARC)

// Specific Validation
TaiwanIdValidator::validateNationId('A123456789'); // true
TaiwanIdValidator::validateArcId('A800000014'); // true
TaiwanIdValidator::validateUbn('12345678'); // false

// Taiwan Company UBN
TaiwanIdValidator::validateUbn("84149961") // true
TaiwanIdValidator::validateUbn("22099131") // true
TaiwanIdValidator::validateUbn("!@)(#&6y01)") // false
TaiwanIdValidator::validateUbn("25317520") // false
TaiwanIdValidator::validateUbn("00000000") // false
```

### Examples

[](#examples)

```
require 'vendor/autoload.php';

use TaiwanIdValidator\TaiwanIdValidator;

// National ID
var_dump(TaiwanIdValidator::validate('A123456789'));         // bool(true)
var_dump(TaiwanIdValidator::validateNationId('A123456789')); // bool(true)
var_dump(TaiwanIdValidator::validateNationId('A123456700')); // bool(false)

// Taiwan Company UBN
var_dump(TaiwanIdValidator::validateUbn('84149961')); // bool(true)
var_dump(TaiwanIdValidator::validateUbn('00000000')); // bool(false)

// New ARC
var_dump(TaiwanIdValidator::validate('A800000014'));      // bool(true)
var_dump(TaiwanIdValidator::validateArcId('A800000014')); // bool(true)

// Old ARC
var_dump(TaiwanIdValidator::validate('AC01234567'));      // bool(true)
var_dump(TaiwanIdValidator::validateArcId('AC01234567')); // bool(true)
```

Testing
-------

[](#testing)

Run unit tests with PHPUnit:

```
./vendor/bin/phpunit tests
```

License
-------

[](#license)

MIT License

###  Health Score

33

—

LowBetter than 72% of packages

Maintenance70

Regular maintenance activity

Popularity10

Limited adoption so far

Community2

Small or concentrated contributor base

Maturity40

Maturing project, gaining track record

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

Unknown

Total

1

Last Release

173d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/c0c8474defb6c8df1f3bcbaacec6d155190c870523dfd919a7ceafc47a12408e?d=identicon)[guanting112](/maintainers/guanting112)

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/guanting112-php-taiwan-id-validator/health.svg)

```
[![Health](https://phpackages.com/badges/guanting112-php-taiwan-id-validator/health.svg)](https://phpackages.com/packages/guanting112-php-taiwan-id-validator)
```

###  Alternatives

[marcosh/php-validation-dsl

A DSL for validating data in a functional fashion

483.9k](/packages/marcosh-php-validation-dsl)

PHPackages © 2026

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