Download the PHP package chaoswey/taiwan-id-validator without Composer

On this page you can find all versions of the php package chaoswey/taiwan-id-validator. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package taiwan-id-validator

Taiwan ID Validator

一組 PHP / Laravel 共用的驗證工具,支援台灣營利事業統一編號、國民身分證、新舊式外來人口統一證號與常見證號格式。2025 版以策略模式重構,可依需求替換或擴充驗證器,同時保留舊有 API 以利升級。

特色

安裝

快速開始

Laravel Facade

純 PHP

Laravel 驗證規則

規則名稱 說明 範例
isBan 統一編號。參數:old/oldRules 套用舊演算法 isBan:old
isIdCardNumber 身分證/外來人口證號。支援複數參數(逗號分隔)。
scope=a\|b 指定驗證範圍(詳見下方說明)。
nationalId=false 關閉身分證驗證。
ui=true/false 或 uiOld=true、uiNew=false 控制新舊格式。
uiNewCategories=foreignOrStateless,statelessResident 指定可接受族群。
isIdCardNumber:scope=citizen,
isIdCardNumber:nationalId=false,uiOld=false,uiNewCategories=hkMacaoResident,
isIdCardNumber:scope=resident-new,uiNewCategories=foreignOrStateless,
isIdCardNumber:scope=resident,
citizen,ui=false
isMobileBarcode 電子發票手機條碼 -
isCitizenDigitalCertificate 自然人憑證 -
isDonationCode 電子發票捐贈碼 -
isCreditCard 信用卡號,參數加上 issuer 代表同時檢查發卡組織 isCreditCard:issuer

相容舊版規則

原有的規則名稱仍可使用(isGUI、isNI、isRC、isNewRC、isOriginalRC、isCDC、isCellPhoneBarcode、isDonateCode),內部已改呼叫新方法,建議逐步調整為新命名。

API 一覽

方法 說明與選項
isBan(mixed $value, array $options = []) 驗證統一編號。applyOldRules 選項開啟舊演算法。
isIdCardNumber(mixed $value, array $options = []) 統一的身分證/外來人口證號驗證。選項:
- scope:字串或陣列(citizen、resident-new、resident-original、resident)。
- nationalId:布林,預設 true。
- uiNumber.oldFormat:布林,預設 true。
- uiNumber.newFormat.enabled:布林,預設 true。
- uiNumber.newFormat.categories:陣列,預設全部 true,可設定 foreignOrStateless、statelessResident、hkMacaoResident、mainlandChinaResident。
isMobileBarcode(mixed $value) 電子發票手機條碼。
isCitizenDigitalCertificate(mixed $value) 自然人憑證碼。
isDonationCode(mixed $value) 電子發票捐贈碼。
isCreditCardNumberValid(mixed $value, array $options = []) 信用卡卡號。checkIssuerRegexes 控制是否驗證發卡組織。

舊版函式(例如 isGuiNumberValid、isNationalIdentificationNumberValid 等)仍可使用,但已標記為 @deprecated,會轉呼叫新 API。

IdCard scope 與 uiNumber 參數說明

範例:

自訂驗證器

每一種驗證皆為獨立類別(位於 src/Validators)。若需擴充,實作 Chaoswey\TaiwanIdValidator\Contracts\ValidatorInterface 後,可透過建構 TaiwanIdValidator 時注入自訂工廠,或註冊自己的 Service Provider 覆寫容器綁定。

升級指南

參考來源


All versions of taiwan-id-validator with dependencies

PHP Build Version
Package Version
Requires php Version >=8.1
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package chaoswey/taiwan-id-validator contains the following files

Loading the files please wait ...