mero/br-validator-bundle

This package is abandoned and no longer maintained. No replacement package was suggested.

Bundle for Symfony with validators for Brazilian location.

1.1.0 2016-06-22 20:26 UTC

This package is auto-updated.

Last update: 2023-04-17 02:59:35 UTC


README

SensioLabsInsight Scrutinizer Code Quality Build Status Latest Stable Version Total Downloads License

Bundle for Symfony with validators for Brazilian location.

Requeriments

  • PHP 5.4.9 or above
  • Symfony 2.8 or above(including Symfony 3)

Instalation with composer

  1. Open your project directory;
  2. Run composer require mero/br-validator-bundle to add MeroBrValidatorBundle in your project vendor;
  3. Open my/project/dir/app/AppKernel.php;
  4. Add Mero\Bundle\BrValidatorBundle\MeroBrValidatorBundle().

Symfony validators

Applies to Options Class Validator Description
property or method message CPF CPFValidator Validates number of CPF(individual registration)
property or method message CNH CNHValidator Validates number of CNH(national driving license)
property or method message CNPJ CNPJValidator Validates number of CNPJ(corporate registration)

Basic usage

<?php

use Mero\Bundle\BrValidatorBundle\Validator\Constraints as BrAssert;

class People
{
    /**
     * @var string Brazilian individual registration
     *
     * @BrAssert\CPF()
     */
    private $cpf;

    /**
     * @var string Brazilian corporate registration
     *
     * @BrAssert\CNPJ()
     */
    private $cnpj;

    /**
     * @var string Brazilian national driving license
     *
     * @BrAssert\CNH()
     */
    private $cnh;
}