PHP code example of seisigmasrl / dgii-rnc-validator

1. Go to this page and download the library: Download seisigmasrl/dgii-rnc-validator 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/ */

    

seisigmasrl / dgii-rnc-validator example snippets



...
// 132620951 is a valid RNC
$validatedRnc = DgiiRncValidator::check("132620951");
var_dump($validatedRnc);

// array(4) {
//    ["rnc"]=> string(9) "132620951"
//    ["name"]=> string(29) "KOI CORPORATION BY SAIKOV SRL"
//    ["commercial_name"]=> string(25) "KOI CORPORATION BY SAIKOV"
//    ["status"]=> string(6) "Active"
// }

// 123456789 is an invalid RNC
$validatedRnc = DgiiRncValidator::check("123456789");
var_dump($validatedRnc); // bool(false)


...
// 132620951 is a valid RNC
$validatedRnc = DgiiRncValidator::validateRNC("132620951");
var_dump($validatedRnc); // bool(true)

// 123456789 is an invalid RNC
$validatedRnc = DgiiRncValidator::validateRNC("123456789");
var_dump($validatedRnc); // bool(false)


...
// 132620951 is a valid RNC
$rncType = DgiiRncValidator::rncType("132620951");
var_dump($rncType); // enum(Types::RNC)

// 123456789 is an invalid RNC
$rncType = DgiiRncValidator::rncType("04800009577");
var_dump($rncType); // enum(Types::CEDULA)

var_dump(Types::RNC->toString()) // string(RNC)

var_dump(Types::RNC->toCode()) // string(01)


...
$results = Utils::getNumbers("abc123456");
var_dump($results); // string(6) "123456"

$results = Utils::getNumbers("asdfasdfs");
var_dump($results); // bool(false)


...
$result = Utils::luhnAlgorithmValidation("79927398713");
var_dump($result); // bool(true)

$result = Utils::luhnAlgorithmValidation("79927398715");
var_dump($result); // bool(false)


...
$result = Utils::validateDominicanCitizenId("04800009575");
var_dump($result); // bool(true)

$result = Utils::validateDominicanCitizenId("04800009577");
var_dump($result); // bool(false)