承接 lochinvarwest/sa-id-validation 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

lochinvarwest/sa-id-validation

Composer 安装命令:

composer require lochinvarwest/sa-id-validation

包简介

A simple validator for South African ID numbers;

README 文档

README

Installation

  • Run the following n your project root:
    composer require lochinvarwest/sa-id-validation
    

Instantiation and Usage

To instantiate, use either:

$validator = SAIdValidator::create($id_number);

or:

$validator = new SAIdValidator($id_number);

or use the Request Rule validator

'idno' => ['required', new SAIdNumber()]

Available Methods:

Validate

The validate() method checks the number of digits, that the ID number represents a valid birth date and that the Luhn algorithm checksum digit is correct. It returns 'true' on success or an error message on failure.

$validator->validate(); // or as above

Check String Length

The validateLength() method checks that the ID number has 13 digits

$validator->validateLength();

Check DoB digits

The validateDateOfBirth() method checks that the ID number represents a valid date for the date of birth.

$validator->validateDateOfBirth();

Get DoB

The getDateOfBirth() method returns a Carbon date object of the date of birth denoted in the provided ID number.

$validator->getDateOfBirth();

Check Checksum digit

The validateChecksum() method checks that the Luhn algorith checksum digit is correct for the ID number supplied.

$validator->validateChecksum();

Check Gender

The validateGender($gender) method checks that the gender supplied corresponds to the gender denoted in the ID number. The argument is "Female: or "Male" or "F" or "M" (case insensitive)

$validator->validateGender($gender);

Get Gender

The getGender() method returns the gender denoted in the ID number.

$validator->getGender();

Check Citizenship

The validateCitizen($citizenship) method checks that citizenship or residency denoted in the ID number corresponds to the status provided. The argument is "citizen: or "resident" (case insensitive)

$validator->validateCitizen();

Get Citizenship

The getCitizen() method returns the citizenship status denoted in the ID number.

$validator->getCitizen();

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: GPL-3.0-or-later
  • 更新时间: 2020-08-11

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固