2017 © Pedro Peláez
 

library br-validations

Common validations for Brazillian numbers, such as CPF, CNPJ and others

image

websix/br-validations

Common validations for Brazillian numbers, such as CPF, CNPJ and others

  • Monday, March 2, 2015
  • by websix
  • Repository
  • 4 Watchers
  • 4 Stars
  • 9 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 10 Versions
  • 0 % Grown

The README.md

BrValidations

Common validations for Brazillian numbers, such as CPF, CNPJ and others, (*1)

Build Status, (*2)

Validators

CnpjValidator

Validates a CNPJ number against his validation digits, (*3)

Usage:, (*4)

```php /** * Somewere calling an autoloader and opening php */ use Websix\BrValidations\Validators\CnpjValidator, Websix\BrValidations\Exceptions;, (*5)

// ..., (*6)

$validator = new CnpjValidator();, (*7)

try { $isValid = $validator->validate($aCnpj); } catch (\InvalidArgumentException $e) { // Has exceptions that can tell you what failed switch (true) { case $e instanceof Exceptions\InvalidCnpjException: // Is really a invalid CNPJ // ... case $e instanceof Exceptions\EmptyArgumentException: // If the CNPJ is an empty string or something like that // ... case $e instanceof Exceptions\InvalidLengthException: // If the CNPJ do not have his correct length // ... case $e instanceof Exceptions\NotOnlyDigitsException: // If the passed CNPJ has something other than digits in the string // ... case $e instanceof Exceptions\NotStringException: // if the passed CNPJ not is a string // ... } } ```, (*8)

Numbers planned to be added + CPF + State Inscription Number (Inscrição estadual) + OAB + CRM + CREA + PIS/PASEP + Passports, (*9)

Usage

Install from Composer:, (*10)

composer require "websix/br-validations"

And add it with the php use keyword:, (*11)

use Websix\BrValidations\Validations\CnpjValidator;

$validator = new CnpjValidator();

License

MIT License, (*12)

The Versions

02/03 2015

dev-master

9999999-dev

Common validations for Brazillian numbers, such as CPF, CNPJ and others

  Sources   Download

MIT

The Development Requires

validation brazil brasil validators cnpj cpj brazillian

02/03 2015

dev-develop

dev-develop

Common validations for Brazillian numbers, such as CPF, CNPJ and others

  Sources   Download

MIT

The Development Requires

02/03 2015

0.1.3

0.1.3.0

Common validations for Brazillian numbers, such as CPF, CNPJ and others

  Sources   Download

MIT

The Development Requires

02/03 2015

0.1.2

0.1.2.0

Common validations for Brazillian numbers, such as CPF, CNPJ and others

  Sources   Download

MIT

The Development Requires

02/03 2015

0.1.1

0.1.1.0

Common validations for Brazillian numbers, such as CPF, CNPJ and others

  Sources   Download

MIT

The Development Requires

02/03 2015

0.1.0

0.1.0.0

Common validations for Brazillian numbers, such as CPF, CNPJ and others

  Sources   Download

MIT

The Development Requires

02/03 2015

0.0.4

0.0.4.0

Common validations for Brazillian numbers, such as CPF, CNPJ and others

  Sources   Download

MIT

The Development Requires

02/03 2015

0.0.3

0.0.3.0

Common validations for Brazillian numbers, such as CPF, CNPJ and others

  Sources   Download

MIT

The Development Requires

02/03 2015

0.0.2

0.0.2.0

Common validations for Brazillian numbers, such as CPF, CNPJ and others

  Sources   Download

MIT

The Development Requires

02/03 2015

0.0.1

0.0.1.0

Common validations for Brazillian numbers, such as CPF, CNPJ and others

  Sources   Download

MIT

The Development Requires