Last Updated | | Ratings | | Unique User Downloads | | Download Rankings |
2020-12-10 (7 days ago) | | Not yet rated by the users | | Total: 14 This week: 14 | | All time: 10,136 This week: 16 |
|
Description | | Author |
This package is specific mainly for applications used in Brazil .
This package can validate documents like CPF, CNPJ, CNH and NIS .
It can take the strings with the numbers of documents of people and companies from Brazil and perform format and check digit verifications to determine if they can be valid.
In Portuguese:
Esta classe pode validar documentos como CPF, CNPJ, CNH e NIS.
A class pode pegar strings de texto com os números de documentos de pessoas e empresas do Brasil e realizar validações de formato e dígitos de verificação para determinar se eles podem ser válidos. | |
|
Details
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).
|
Applications that use this package |
|
No pages of applications that use this class were specified.
If you know an application of this package, send a message to the author to add a link here.