PHPackages                             igorsantos07/yii-br-validator - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Validation &amp; Sanitization](/categories/validation)
4. /
5. igorsantos07/yii-br-validator

AbandonedYii-extension[Validation &amp; Sanitization](/categories/validation)

igorsantos07/yii-br-validator
=============================

Provide validations and features for brazilian localization on Yii 1.1.\*

v1.0.4(11y ago)151BSD-3-ClausePHP

Since May 17Pushed 11y ago2 watchersCompare

[ Source](https://github.com/igorsantos07/yii-br-validator)[ Packagist](https://packagist.org/packages/igorsantos07/yii-br-validator)[ RSS](/packages/igorsantos07-yii-br-validator/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependencies (2)Versions (6)Used By (0)

Yii Brazilian Validators
========================

[](#yii-brazilian-validators)

> **Superseeded by [`yii-br-pack`](https://github.com/igorsantos07/yii-br-pack)** [![Latest yii-br-pack stable version](https://camo.githubusercontent.com/01d8a6c44d06eae8a9b588fc78cc0a56412737f3c56d46f7d432ab2711c1e86a/68747470733a2f2f706f7365722e707567782e6f72672f69676f7273616e746f7330372f7969692d62722d7061636b2f762f737461626c652e737667)](https://packagist.org/packages/igorsantos07/yii-br-pack)

Yii 1.1 Extension that provides validators for Brazilian localization.

- CPF: Cadastro de Pessoa Física (like a Security Social Number in USA)
- CNPJ: Cadastro Nacional de Pessoa Jurídica
- landlines: beginning with 2 and 3
- cellphones: 9 digits or 8 digits beginning with 7, 8 or 9

Installation
------------

[](#installation)

The preferred way to install this extension is through [Composer](http://getcomposer.org/download/).

[![Latest Stable Version](https://camo.githubusercontent.com/0ca0519469bb7cb321d8ea211446a2e42cfdc9d0f7c29bcf5f9327208990ace7/68747470733a2f2f706f7365722e707567782e6f72672f69676f7273616e746f7330372f7969692d62722d76616c696461746f722f762f737461626c652e737667)](https://packagist.org/packages/igorsantos07/yii-br-validator)[![Total Downloads](https://camo.githubusercontent.com/8f1cec1e2a7dd14ba3d17c359701aa36d3ea4e906a314dac3d008d7903f46262/68747470733a2f2f706f7365722e707567782e6f72672f69676f7273616e746f7330372f7969692d62722d76616c696461746f722f646f776e6c6f6164732e737667)](https://packagist.org/packages/igorsantos07/yii-br-validator)

Either run this:

```
php composer.phar require --prefer-dist igorsantos07/yii-br-validator:1.*

```

or add this to the "require" section of your `composer.json` file.

```
"igorsantos07/yii-br-validator": "1.*"

```

Usage
-----

[](#usage)

Add the rules as the following example:

```
class PersonForm extends CModel {

  public $cpf;
  public $cnpj;
  public $cellphone;
  public $landline;
  public $phone;
  public $areaCode;

  // For maximum readability, you should create an alias for the validator folder :)
  // Here we are assuming you have at least an alias for your vendor folder.
  public function rules() {
    // Using short array notation but the class is PHP  PhoneValidator::TYPE_CELLPHONE],
      // Cellphone-only validator, not validating area code
      [
        'cellphone',
        'vendor.igorsantos07.yii-br-validator.PhoneValidator',
        'type'     => PhoneValidator::TYPE_CELLPHONE,
        'areaCode' => false
      ],
      // Landline-only validator
      ['landline', 'vendor.igorsantos07.yii-br-validator.PhoneValidator', 'type' => PhoneValidator::TYPE_LANDLINE],
      // Any phone validator - cellphone or landline
      ['phone', 'vendor.igorsantos07.yii-br-validator.PhoneValidator'],
      // Cellphone validator with external area code check
      [
        'cellphone',
        'vendor.igorsantos07.yii-br-validator.PhoneValidator',
        'type'              => PhoneValidator::TYPE_CELLPHONE,
        'areaCodeAttribute' => 'areaCode'
      ],
    ];
  }
}
```

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity67

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~13 days

Total

5

Last Release

4324d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/8768be93b53951c06cbe2de65c60afdbd42d08e8baa886fbc2db3069c8fccc3e?d=identicon)[igorsantos07](/maintainers/igorsantos07)

---

Top Contributors

[![igorsantos07](https://avatars.githubusercontent.com/u/532299?v=4)](https://github.com/igorsantos07 "igorsantos07 (16 commits)")[![leandrogehlen](https://avatars.githubusercontent.com/u/1750751?v=4)](https://github.com/leandrogehlen "leandrogehlen (16 commits)")[![wbraganca](https://avatars.githubusercontent.com/u/1946359?v=4)](https://github.com/wbraganca "wbraganca (2 commits)")

---

Tags

validatormodelphoneyiibrbrazilcpfcnpjbrasilcellphonelandline

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/igorsantos07-yii-br-validator/health.svg)

```
[![Health](https://phpackages.com/badges/igorsantos07-yii-br-validator/health.svg)](https://phpackages.com/packages/igorsantos07-yii-br-validator)
```

###  Alternatives

[yiibr/yii2-br-validator

Provide validations and features for brazilian localization

14103.2k4](/packages/yiibr-yii2-br-validator)[bissolli/validador-cpf-cnpj

Classe em PHP para validação de CPF e CNPJ.

2089.0k](/packages/bissolli-validador-cpf-cnpj)[laravel-validation-rules/us-state

Validate US States and Canada Provinces

16172.7k](/packages/laravel-validation-rules-us-state)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
