abdelazizomar / egyptian-national-id-extractor

此包用于通过国民身份证提取公民信息

1.0 2021-11-17 20:01 UTC

This package is auto-updated.

Last update: 2024-09-15 04:21:03 UTC


README

从埃及国民身份证中提取信息,如出生日期、出生地、性别等

适用于仅使用埃及国民身份证的政府组织和特殊组织

要求

  1. Composer
  2. PHP版本8或更高

安装

composer require abdelazizomar/egyption-national-id-extractor

使用

// Intitialize CitizenNationalIdExtractor class
$citizenData = new CitizenNationalIdExtractor(nationalId: "29803050202393");
// To get citizen century code
$citizenData->getCitizenCenturyCode();

//or you can use null-safe operator to make sure that national id is correct equal (14 number) and the output may be (null|int)
$citizenData->verifyCitizen()?->getCitizenCenturyCode();

int(2)
// To get citizen goverment code
$citizenData->getCitizenGovermentCode();

//or you can use null-safe operator to make sure that national id is correct equal (14 number) and the output may be (null|string)
$citizenData->verifyCitizen()?->getCitizenGovermentCode();

string(2) "02"
// To get citizen Goverment
$citizenData->GetCitizenGoverment(code: citizenData->getCitizenGovermentCode());

//or you can use null-safe operator to make sure that national id is correct equal (14 number) and the output may be (null|string)
$citizenData->verifyCitizen()?->GetCitizenGoverment(code: citizenData->getCitizenGovermentCode());

string(10) "Alexandria"
// To get citizen birthday year
$citizenData->getCitizenBirthdayYear();

//or you can use null-safe operator to make sure that national id is correct equal (14 number) and the output may be (null|int)
$citizenData->verifyCitizen()?->getCitizenBirthdayYear();

int(1998)
// To get citizen birthday month
$citizenData->getCitizenBirthdayMonth();

//or you can use null-safe operator to make sure that national id is correct equal (14 number) and the output may be (null|string)
$citizenData->verifyCitizen()?->getCitizenBirthdayMonth();

string(2) "03"
// To get citizen birthday day
$citizenData->getCitizenBirthdayMonth();

//or you can use null-safe operator to make sure that national id is correct equal (14 number) and the output may be (null|string)
$citizenData->verifyCitizen()?->getCitizenBirthday();

string(2) "05"
// To get citizen gender
$citizenData->getCitizenGender();

//or you can use null-safe operator to make sure that national id is correct equal (14 number) and the output may be (null|string)
$citizenData->verifyCitizen()?->getCitizenGender();

string(4) "Male"
// To get citizen all information
$citizenData->getCitizenInfo();

//or you can use null-safe operator to make sure that national id is correct equal (14 number) and the output may be (null|array)
$citizenData->verifyCitizen()?->getCitizenInfo();

array(3) {
  ["DateOfBirth"]=>
  string(10) "1998/03/05"
  ["Gender"]=>
  string(4) "Male"
  ["Town"]=>
  string(10) "Alexandria"
}