dynamikaweb/yii2-br-validators

Yii2 Brazilian document validator

Installs: 2 397

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 0

Type:yii2-extension

v1.0 2020-08-18 14:18 UTC

This package is auto-updated.

Last update: 2024-03-19 02:15:47 UTC


README

Latest Stable Version Total Downloads License Codacy Badge Build Test Latest Unstable Version

About

Brazilian document validator

  • Titulo de Eleitor: Número do documento eleitoral.

Installation

The preferred way to install this extension is through composer.

Either run

$ composer require dynamikaweb/yii2-br-validators "*"

or add

"dynamikaweb/yii2-br-validators": "*"

to the require section of your composer.json file.

Usage

Add the rules as the following example

use Yii;
use yii\base\Model;
use dynamikaweb\validators\TituloValidator;

class PersonExample extends Model
{
	public $name;
	public $titulo_eleitor;
    
	/**
	 * @return array the validation rules.
	 */
	public function rules()
	{
		return [
            		// name is required
			['name', 'required'],
			// Título Eleitoral validator
			['titulo_eleitor', TituloValidator::className()]
		];
	}
}