定制 experteam/indentification-number-validator 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

experteam/indentification-number-validator

Composer 安装命令:

composer require experteam/indentification-number-validator

包简介

PHP library for validating identification documents from multiple countries

README 文档

README

A PHP library for validating identification numbers from multiple countries.
Provides a simple and unified interface for validating official national documents.

Install

composer require experteam/indentification-number-validator

Update

composer update experteam/indentification-number-validator

Usage

Basic Example

use Experteam\IndentificationNumberValidator\ValidatorFactory;

$validator = ValidatorFactory::make('MX'); // Mexico example

$result = $validator->validate([
    'identificationNumber' => 'GODE561231GR8',
    'identificationCode'   => 'RFC'
]);

Supported Countries

Supported Countries

Country Code Validator Class
Brasil BR BRValidator
GUATEMALA GT GTValidator

More countries can be added easily.

Adding a New Country

  1. Create a new validator inside src/Validators/.
use Experteam\IndentificationNumberValidator\Contracts\IdentificationValidatorInterface;

class BRValidator implements IdentificationValidatorInterface
{
    public function validate(string $number): array
    {
        return [true, "{$name} is valid."];
    }
}
  1. Register the validator in ValidatorFactory.php:
case 'CO':
    return new COValidator();

Error Handling

use Experteam\IndentificationNumberValidator\Exceptions\UnsupportedCountryException;

try {
    ValidatorFactory::make('XX');
} catch (UnsupportedCountryException $e) {
    echo $e->getMessage();
}

统计信息

  • 总下载量: 719
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 4
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-12-03

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固