cancio-labs/cpf-symfony-validator

一个自定义的 Symfony 验证器,用于验证 CPF。

1.0.0 2024-07-25 02:41 UTC

This package is not auto-updated.

Last update: 2024-09-20 01:58:17 UTC


README

一个自定义的 Symfony 验证器,用于验证 CPF。

需求

  • PHP >= 7.4

安装

composer require cancio-labs/cpf-symfony-validator

如何使用它

在您的实体中添加 CpfConstraint...

use CancioLabs\Validator\Cpf\CpfConstraint;

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

或者将其添加到约束列表中

use CancioLabs\Validator\Cpf\CpfConstraint;    

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