websix/br-validations 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

websix/br-validations

最新稳定版本:0.1.3

Composer 安装命令:

composer require websix/br-validations

包简介

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

README 文档

README

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

Build Status

Validators

CnpjValidator

Validates a CNPJ number against his validation digits

Usage:

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

// ...

$validator = new CnpjValidator();

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
      // ...
  }
}

Numbers planned to be added

  • CPF
  • State Inscription Number (Inscrição estadual)
  • OAB
  • CRM
  • CREA
  • PIS/PASEP
  • Passports

Usage

Install from Composer:

composer require "websix/br-validations"

And add it with the php use keyword:

use Websix\BrValidations\Validations\CnpjValidator;

$validator = new CnpjValidator();

License

MIT License

统计信息

  • 总下载量: 19
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 3
  • 点击次数: 3
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 3
  • Watchers: 3
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-03-02

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固