paradisesessions/validator-cpf-cnpj

A very simple class for validate CPF|CNPJ.

v1.0.1 2023-04-15 14:11 UTC

This package is auto-updated.

Last update: 2024-12-16 00:29:33 UTC


README

Paradise Sessions

Installation  |   Technologies  |   Using  |   Tests

Version PHP Version License

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