PHP code example of pauloalmeidasilva / cpfcnpj-validation
1. Go to this page and download the library: Download pauloalmeidasilva/cpfcnpj-validation 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/ */
pauloalmeidasilva / cpfcnpj-validation example snippets
Src\Validator;
var_dump(Validator::validate('529.982.247-25')); // true
var_dump(Validator::validate('04252011000110')); // true (CNPJ sem pontuação)
Src\Cpf;
use Src\Validator;
$cpf = Cpf::generate(); // formatado por padrão
$cpfRaw = Cpf::generate(false); // sem formatação (apenas dígitos)
var_dump($cpf);
var_dump(Validator::validate($cpfRaw));