Documentation
Springy BrazilianNumbers
Brazilian documents numbers validator for PHP.

Requirements
Instalation
To get the latest stable version of this component use:
"require": {
"springy-framework/brazilian-numbers": "*"
}
in your composer.json file.
Usage
I suppose that the following example is all you need:
<?php
require 'vendor/autoload.php'; // If you're using Composer (recommended)
$brNum = 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";
}
Contributing
Please read our contributing document and thank you for
doing that.
Code of Conduct
In order to ensure that our community is welcoming to all, please review and
abide by the code of conduct.
License
This project is licensed under The MIT License (MIT).