1. Go to this page and download the library: Download spoorsny/south-african-id library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
spoorsny / south-african-id example snippets
use Spoorsny\ValueObjects\SouthAfricanId;
$idNumber = new SouthAfricanId('9308062469083');
$idNumber1 = new SouthAfricanId('4608162219097');
$idNumber2 = new SouthAfricanId($idNumber1);
$idNumber = new SouthAfricanId('4608162219097');
strval($idNumber); // Evaluates to '460816 2219 097'.
echo $idNumber; // Prints '460816 2219 097'.
$idNumber1 = new SouthAfricanId('4608162219097');
$idNumber2 = new SouthAfricanId('4608162219097');
$idNumber3 = new SouthAfricanId('8202277454090');
$idNumber1->equals($idNumber2); // true
$idNumber1->equals($idNumber3); // false