New

Just launched: Vueblocks, a brand-new search engine for Vue packages! Explore Vueblocks →

meditate/twid

Taiwan ID Number validation and maker.
8,769 27
Install
composer require meditate/twid
Latest Version:0.2.0
PHP:^7.0
License:MIT
Last Updated:Jul 31, 2023
Links: GitHub  ·  Packagist
Maintainer: meditate

Taiwan ID Number validation and maker

meditate/twid is PHP Library to validate and make Taiwan ID Number.

Contents

Installation

You can install the package via composer:

composer require meditate/twid

If you are Laravel project, add twid facade in app/config/app.php:

'aliases' => [
	...
    
    'Twid' => Meditate\IdentityCard\Facades\TaiwanIdentityCard::class,
]

Usage

Basic

use Meditate\IdentityCard\TaiwanIdentityCard;

$taiwanIdCard = new TaiwanIdentityCard;

Now, you can use check method to validate ID Number:

$taiwanIdCard->check('A123456789'); // true
$taiwanIdCard->check('A223456789'); // false

Or generate a fake ID Number:

// A123456789
$taiwanIdCard->make();

// B167663827
$taiwanIdCard->make('B');

// A259776352
$taiwanIdCard->make('A', 2);

Facade

Also you can use facade:

Twid::check('A123456789');

Twid::make();

Laravel validation

In Laravel, you can easy use in "form request". Just need to add tw_id rule to the rules method:

public function rules()
{
    return [
        'id_number' => 'tw_id'
    ];
}

License

The MIT License (MIT). Please see License File for more information.

Related Packages

claraleigh/naughty-username

Validate that a username is not a naughty one

24,243 0
cohensive/validation

Extra functionality for Laravel 5 Validator.

13,938 14
jedrzej/validator-extended-syntax

Laravel 4/5 package that adds validator negation to Laravel's validation module

11,580 3
shin1x1/laravel-validator-builder

Laravel 4 Validator builder

7,436 2
digitonic/validation

A Laravel custom validation package with some out of the box validators.

2,526 2

Version History

Version Released PHP License
0.2.0 ^7.0 MIT
0.1.0 ^7.0 MIT