cpf-validator A CValidator algorithm for Brazilian CPF registration ID

  1. Descrição em Português
  2. Como usar
  3. English Description
  4. Requirements
  5. Usage
  6. Code
  7. Resources

Descrição em Português

Valida entrada através do algoritimo com as regras oficiais de geração de CPF. Aceita apenas CPF válido (sequencias são rejeitadas)

Como usar

  1. Descompacte o arquivo PHP na sua pasta de extensões ou em qualquer outro lugar (Eu usei extensions/validator)
  2. Use o código a seguir dentro do seu Model para validar o campo: Clique para ver

English Description

Validates, by the official algorithm rules, if the input is a valid CPF.

CPF is an oficial brazilian document who every person who is a taxpayer must have. Very common on every commercial form.

Requirements

Yii 1.0 or above

Usage

  1. Extract the PHP file to the extensions folder or any of your choice (I've used ext.validators)
  2. Use the following code to validate the field on the model

Code

class example extends CModel {
	//[....]
	public function rules()
	{
		return array(
			//[....]
			array('cpf_field', 'ext.validators.cpf'),
		);
	}
}

Resources

The original creator of the validation algorithim: Moacir Fernandes

7 0
6 followers
1 155 downloads
Yii Version: 1.1
License: BSD-2-Clause
Category: Validation
Developed by: Panurge
Created on: May 13, 2011
Last updated: 12 years ago

Downloads

show all

Related Extensions