Skip to content

Latest commit

 

History

History
30 lines (18 loc) · 549 Bytes

README.md

File metadata and controls

30 lines (18 loc) · 549 Bytes

CPF Symfony Validator

A custom Symfony Validator that validates CPF.

Requirements

  • PHP >= 7.4

Installation

composer require cancio-labs/cpf-symfony-validator

How to use it

Add the CpfConstraint in your entity...

use CancioLabs\Validator\Cpf\CpfConstraint;

#[CpfConstraint]
private ?Cpf $cpf = null;

or add it to a constraint list:

use CancioLabs\Validator\Cpf\CpfConstraint;    

$formBuilder->add('cpf', TextType::class, [
    'constraints' => [
        new CpfConstraint(),
    ],
]);