PHP code example of mateusjunges / cpf-cnpj-validator
1. Go to this page and download the library: Download mateusjunges/cpf-cnpj-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/ */
mateusjunges / cpf-cnpj-validator example snippets
use Junges\CpfCnpjValidator\Validator;
$v = (new Validator)("360.928.960-01"); // True
$v = (new Validator)("360.928.960-01", \Junges\CpfCnpjValidator\Enums\TaxId::CPF); // True
$v = (new Validator)("360.928.960-01", \Junges\CpfCnpjValidator\Enums\TaxId::CNPJ); // False
$v = (new Validator)("91.881.588/0001-95"); // True
$v = (new Validator)("91.881.588/0001-95", \Junges\CpfCnpjValidator\Enums\TaxId::CNPJ); // True
$v = (new Validator)("91.881.588/0001-95", \Junges\CpfCnpjValidator\Enums\TaxId::CPF); // True