rafaelrabaco/yii2-validator
Composer 安装命令:
composer require rafaelrabaco/yii2-validator
包简介
Validações de documentos do Brasil e Portugal
README 文档
README
Yii2 Extension that provide validations and features for Brazilian and Portugal localization
- CPF: Cadastro de pessoa física (BR)
- CNPJ: Cadastro nacional de pessoa jurídica (BR)
- CEI: Cadastro específico no INSS (BR)
- NIF: Número de identificação fiscal (PT)
Installation
The preferred way to install this extension is through composer.
Either run
php composer.phar require --prefer-dist rafaelrabaco/yii2-validator "*"
or add
"rafaelrabaco/yii2-validator": "*"
to the require section of your composer.json file.
Usage
Add the rules as the following example
use Yii; use yii\base\Model; use rafaelrabaco\validator\CpfValidator; use rafaelrabaco\validator\CnpjValidator; use rafaelrabaco\validator\CeiValidator; use rafaelrabaco\validator\NifValidator; class PersonForm extends Model { public $name; public $cpf; public $cnpj; public $cei; public $nif; /** * @return array the validation rules. */ public function rules() { return [ // name is required ['name', 'required'], // cpf validator ['cpf', CpfValidator::className()], // cnpj validator ['cnpj', CnpjValidator::className()], // cei validator ['cei', CeiValidator::className()] // nif validator ['nif', NifValidator::className()] ]; } }
统计信息
- 总下载量: 981
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 2
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: BSD-3-Clause
- 更新时间: 2017-08-11