PHP code example of helsinque / cpf-cnpj

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

    

helsinque / cpf-cnpj example snippets




$validate = new Helsinque\Validator();

try {
    $result = $validate->validate("Cnpj", "42.183.878/0001-50");
} catch (\Exception $e) {
    echo $e->getMessage();
}

echo $result; //true




$config = [
    'API_BIPBOP_KEY' => YOUR_KEY_HERE
];

$validate = new Helsinque\Validator($config);

try {
    $result = $validate->validate("BipBop", "42.183.878/0001-50");
} catch (\Exception $e) {
    echo $e->getMessage();
}

echo $result; //informações sobre o cnpj