hitobias/twid
最新稳定版本:1.0.0
Composer 安装命令:
composer require hitobias/twid
包简介
Taiwan ID Number validation and maker.
关键字:
README 文档
README
hitobias/twid is PHP Library to validate and make Taiwan ID Number. It supports Php 8.1, 8.2
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.
统计信息
- 总下载量: 26
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-03-20