PHP code example of reducktion / socrates

1. Go to this page and download the library: Download reducktion/socrates 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/ */

    

reducktion / socrates example snippets


use Reducktion\Socrates\Socrates;
use Reducktion\Socrates\Constants\Country;

$socrates = new Socrates();
$socrates->validateId('14349483 0 ZV3', Country::Portugal);

if ($socrates->validateId('719102091', Country::Netherlands)) {
    echo 'Valid ID.';
} else {
    echo 'Invalid ID.';
}

$citizen = $socrates->getCitizenDataFromId('3860123012', Country::Estonia);

echo $citizen->getGender(); // 'Gender::Male'
echo $citizen->getDateOfBirth(); // DateTime instance with the date '1986-01-23'
echo $citizen->getAge(); // (The current age as a number)
echo $citizen->getPlaceOfBirth(); // null - Estonia does not encode place of birth on its ID numbers