PHP code example of springy-framework / brazilian-numbers
1. Go to this page and download the library: Download springy-framework/brazilian-numbers 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/ */
springy-framework / brazilian-numbers example snippets
m = new Springy\BrazilianNumbers();
// The following numbers can also be used without a mask.
$cpf = '899.678.736-12';
$cnpj = '76.871.442/0001-75';
$cnh = '21059294129';
$nis = '640.58791.38-4';
if ($brNum->isCpfValid($cpf)) {
echo "CPF valid!\n";
} else {
echo "CPF invalid!\n";
}
if ($brNum->isCnpjValid($cnpj)) {
echo "CNPJ valid!\n";
} else {
echo "CNPJ invalid!\n";
}
if ($brNum->isCnhValid($cnh)) {
echo "CNH valid!\n";
} else {
echo "CNH invalid!\n";
}
if ($brNum->isNisValid($nis)) {
echo "NIS valid!\n";
} else {
echo "NIS invalid!\n";
}