Download the PHP package designbycode/south-african-id-validator without Composer

On this page you can find all versions of the php package designbycode/south-african-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 south-african-id-validator

South African ID Validator

Latest Version on Packagist Tests Total Downloads

The South African ID Validator is a PHP class that validates and extracts information from South African ID numbers. It uses the Luhn Algorithm to validate the ID number and provides methods to determine the gender, citizenship, and birthdate of the individual.

Installation

You can install the package via composer:

Usage

Instantiation

To use the South African ID Validator, create an instance of the SouthAfricanIdValidator class:

Validation

To validate an ID number, use the isValid method:

Parsing

To extract information from a valid ID number, use the parse method:

Output:

Gender Determination

To determine the gender of the individual, use the isMale or isFemale methods:

Citizenship Determination

To determine the citizenship of the individual, use the isSACitizen or isPermanentResident methods:

Methods

isValid(mixed $idNumber): bool

Validates the ID number using the Luhn Algorithm and checks if it has a length of 13 digits and is numeric.

isLength13(mixed $idNumber): bool

Checks if the ID number has a length of 13 digits.

isNumber(mixed $idNumber): bool

Checks if the ID number is numeric.

passesLuhnCheck(mixed $idNumber): bool

Validates the ID number using the Luhn Algorithm.

isMale(mixed $idNumber): bool

Determines if the ID number is for a male.

isFemale(mixed $idNumber): bool

Determines if the ID number is for a female.

isSACitizen(mixed $idNumber): bool

Determines if the ID number is for a South African citizen.

isPermanentResident(mixed $idNumber): bool

Determines if the ID number is for a permanent resident.

parse(mixed $idNumber): array

Parses the ID number and returns an array with the following information:

Use Cases

Validating ID numbers in a registration form

Use the isValid method to validate ID numbers in a registration form to ensure that only valid ID numbers are accepted.

Extracting information from ID numbers

Use the parse method to extract information from ID numbers, such as birthdate, age, gender, and citizenship, to populate user profiles or perform analytics.

Determining gender and citizenship

Use the isMale, isFemale, isSACitizen, and isPermanentResident methods to determine the gender and

Testing

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.


All versions of south-african-id-validator with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1|^8.2|^8.3
designbycode/luhn-algorithm Version ^1.0
nesbot/carbon Version ^3.6
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 designbycode/south-african-id-validator contains the following files

Loading the files please wait ....