Recommend this page to a friend! |
![]() |
Info | Documentation | ![]() |
![]() |
![]() |
Reputation | Support forum | Blog | Links |
Ratings | Unique User Downloads | Download Rankings | ||||
Not enough user ratings | Total: 38 | All time: 10,962 This week: 660![]() |
Version | License | PHP version | Categories | |||
brazilian-numbers 1.0.0 | MIT/X Consortium ... | 5 | PHP 5, Validation |
Description | Author | ||||||||
This package is specific mainly for applications used in Brazil
![]() This package can validate documents like CPF, CNPJ, CNH and NIS . |
|
Brazilian documents numbers validator for PHP.
To get the latest stable version of this component use:
"require": {
"springy-framework/brazilian-numbers": "*"
}
in your composer.json file.
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";
}
Please read our contributing document and thank you for doing that.
In order to ensure that our community is welcoming to all, please review and abide by the code of conduct.
This project is licensed under The MIT License (MIT).
![]() |
File | Role | Description | ||
---|---|---|---|---|
![]() |
||||
![]() |
||||
![]() |
||||
![]() ![]() |
Data | Auxiliary data | ||
![]() ![]() |
Data | Auxiliary data | ||
![]() ![]() |
Data | Auxiliary data | ||
![]() ![]() |
Data | Auxiliary data | ||
![]() ![]() |
Data | Auxiliary data | ||
![]() ![]() |
Data | Auxiliary data | ||
![]() ![]() |
Data | Auxiliary data | ||
![]() ![]() |
Lic. | License text | ||
![]() ![]() |
Data | Auxiliary data | ||
![]() ![]() |
Data | Auxiliary data | ||
![]() ![]() |
Doc. | Read me |
![]() |
/ | tests |
File | Role | Description |
---|---|---|
![]() ![]() |
Aux. | Auxiliary script |
![]() |
Class | Class source |
![]() |
Class | Class source |
![]() |
Class | Class source |
![]() |
Class | Class source |
The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page. |
![]() |
Version Control | Unique User Downloads | Download Rankings | |||||||||||||||
100% |
|
|
Applications that use this package |
If you know an application of this package, send a message to the author to add a link here.