PHP code example of paradisesessions / validator-cpf-cnpj

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

    

paradisesessions / validator-cpf-cnpj example snippets


$document = new \ParadiseSessions\Validator\Cpf('123.123.123-00');

// Verify is valid
$document->isValid();

// Check is valid and format numbers
$document->format();

// Verify is valid and return raw data
$document->getDocument();

$document = new \ParadiseSessions\Validator\Cnpj('06.990.590/0001-23');

// Verify is valid
$document->isValid();

// Check is valid and format numbers
$document->format();

// Verify is valid and return raw data
$document->getDocument();

$document = new \ParadiseSessions\Validator\Document('...');

// Verify is valid
$document->isValid();

// Check is valid and format numbers
$document->format();

// Verify is valid and return raw data
$document->getDocument();