PHP code example of cancio-labs / cnpj-validation-function
1. Go to this page and download the library: Download cancio-labs/cnpj-validation-function 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/ */
cancio-labs / cnpj-validation-function example snippets
use function CancioLabs\Cnpj\Functions\assert_cnpj;
use function CancioLabs\Cnpj\Functions\is_valid_cnpj;
use function CancioLabs\Cnpj\Functions\is_valid_cnpj;
is_valid_cnpj('73.078.367/0001-00'); // true
is_valid_cnpj('73078367000100'); // true
is_valid_cnpj('12.ABC.345/01DE-35'); // true
is_valid_cnpj('12ABC34501DE35'); // true
is_valid_cnpj('73.078.367/0001-01'); // false
is_valid_cnpj(null); // false
use function CancioLabs\Cnpj\Functions\assert_cnpj;
assert_cnpj('73.078.367/0001-00');
assert_cnpj('12ABC34501DE35');
// Throws InvalidArgumentException
assert_cnpj('73.078.367/0001-01');