PHP code example of vsilva472 / php-cnpj

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

    

vsilva472 / php-cnpj example snippets


composer 

{
    " "vsilva472/php-cnpj" : "*"
    }
}



w cpf
$cnpj = '23.456.789/0001-55';

// Make the CPF validator
$validator = new \Vsilva472\phpCNPJ\CNPJ();

// @boolean 
$is_cnpj_valid = $cnpj->validate( $_POST[ 'cnpj' ] );

if ( $is_cnpj_valid ) {
    // do something with valid CNPJ
}

else {
    // invalid CNPJ! Do something
}