Skip to content

Validate south african identity numbers and extract limited information about them.

License

Notifications You must be signed in to change notification settings

Vlerrie/south-african-id-validation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

south-african-id-validation

Validate south african identity numbers and extract limited information about them.

Usage

Basic Usage

    use Vlerrie\SouthAfricanIdValidation\SaIdValidator;

    $idValidator = new SaIdValidator();

    //validate an ID
    $idValidator->validateSaId('0123456789012');
    //returns bool

    //extract more info about idnumber
    $idInfo = $idValidator->extractIdInfo('9410045102086');
    //returns object:
    //{
    //  +"idNumber": "0123456789012"
    //  +"length": true
    //  +"dob": "1994-10-04"
    //  +"age": 27
    //  +"gender": "m"
    //  +"citizen": true
    //  +"validId": true
    //  +"errors": []
    //}

Included Laravel rule for validation

use Vlerrie\SouthAfricanIdValidation\ValidSAIdRule;


$validated = $request->validate([
            'idNumber' => [
                'required', 
                new ValidSAIdRule()
            ]
        ]);

About

Validate south african identity numbers and extract limited information about them.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages