PHP code example of helip / niss

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

    

helip / niss example snippets



// Include Composer autoloader

$rawNiss = 'yymmdd-xxxx-cc';

// Validation
$validation = true;
try {
    NISSValidator::isValid($rawNiss);
} catch (Exception $e) {
    // Handle error
    echo $e->getMessage();
    $validation = false;
    // ...
}

if ($validation) {
    // Instantiates a Niss object
    $niss = new NISS($niss);
    
    // Get infos
    $birthdate = $niss->getBirthdate($niss);
    $gender = $niss->getGender()
    $type = $niss->getType();
    $formatted = $niss->getFormattedNiss();
    // ...
    
    // Do stuff
    // ...
}