dtipmam/yii-brazil-cns-validator

dev-main 2021-03-12 02:11 UTC

This package is auto-updated.

Last update: 2024-03-12 08:47:47 UTC


README

68747470733a2f2f796969736f66742e6769746875622e696f2f646f63732f696d616765732f7969695f6c6f676f2e737667

Yii1 Brazil CNS validator


The package provides Yii validation capabilities for Brazil's National Health Card (Cartão Nacional de Saúde do SUS).

We know that Yii1 isn't being maintained anymore, but this will be helpful for legacy applications.

Compatibility

  • Working in Yii 1.1.23

Requirements

  • PHP 7.4 or higher.

Installation

The package could be installed with composer:

composer require dtipmam/yii-brazil-cns-validator --prefer-dist

General usage

Library could be used validating a Yii1 model's field that store be the CNS number.

Validating attribute in a CActiveRecord model class

public function rules() {
    array('cadastro_nacional_saude_sus', '\Dtipmam\YiiValidator\CnsValidator');
}

Credits

Code based on Diego Aguiar's project: https://github.com/diegoraguiar/ngx-brazilian-helpers

TODO

  • Unit tests
  • infection-static-analysis-plugin, phpunit-watcher and psalm for development use