mero / br-validator-bundle
Bundle for Symfony with validators for Brazilian location.
Installs: 71
Dependents: 0
Suggesters: 2
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
Type:symfony-bundle
Requires
- php: >=5.5.9
Requires (Dev)
- phpunit/phpunit: ~4.4
- satooshi/php-coveralls: ~0.6.1
- symfony/symfony: ~2.7
- symfony/validator: ~2.8
This package is auto-updated.
Last update: 2023-04-17 02:59:35 UTC
README
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
- Open your project directory;
- Run
composer require mero/br-validator-bundle
to add MeroBrValidatorBundle in your project vendor; - Open my/project/dir/app/AppKernel.php;
- 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; }