paradisesessions / validator-cpf-cnpj
A very simple class for validate CPF|CNPJ.
Installs: 1 274
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 0
Open Issues: 0
Requires
- php: ^8.1
Requires (Dev)
- phpunit/phpunit: ^8.5
README
Installation | Technologies | Using | Tests
Project
A very simple class for validate CPF|CNPJ.
Uma simples classe para validar CPF|CNPJ.
Installation
By Composer
Via Composer
composer require paradisesessions/validator-cpf-cnpj
Technologies
Using
Example of use for CPF validation and formatting.
Exemplo de uso para validação e formatação de CPF.
$document = new \ParadiseSessions\Validator\Cpf('123.123.123-00'); // Verify is valid $document->isValid(); // Check is valid and format numbers $document->format(); // Verify is valid and return raw data $document->getDocument();
Example of use for CNPJ validation and formatting.
Exemplo de uso para validação e formatação de CNPJ.
$document = new \ParadiseSessions\Validator\Cnpj('06.990.590/0001-23'); // Verify is valid $document->isValid(); // Check is valid and format numbers $document->format(); // Verify is valid and return raw data $document->getDocument();
Example of use for CPF or CNPJ, recognizing type by class
Exemplo de uso para validação e formatação de CPF ou CNPJ, reconhecendo o tipo pela classe.
$document = new \ParadiseSessions\Validator\Document('...'); // Verify is valid $document->isValid(); // Check is valid and format numbers $document->format(); // Verify is valid and return raw data $document->getDocument();
Tests
Test class with PHPUnit.
Testes na classe realizados com PHPUnit.
composer test