lumensistemas/laravel-br-validation
Composer 安装命令:
composer require lumensistemas/laravel-br-validation
包简介
Laravel integration for lumensistemas/br-validation: Rule classes and named validators for Brazilian identifiers (CPF, CNPJ, PIS, Título de Eleitor, CNH, Renavam, placa, CNS, chave PIX, CEP, telefone, boleto, NF-e).
关键字:
README 文档
README
Laravel integration for lumensistemas/br-validation.
Ships Illuminate\Contracts\Validation\ValidationRule classes
and matching string-named rules (cpf, cnpj, pis, …) for
every Brazilian identifier the underlying library covers.
Requirements
- PHP 8.3 or newer
- Laravel 12 or 13
ext-mbstring
Installation
composer require lumensistemas/laravel-br-validation
The service provider is auto-discovered. Publish the translations if you want to override them:
php artisan vendor:publish --tag=laravel-br-validation-lang
Usage
As string-named rules
$request->validate([ 'cpf' => ['required', 'cpf'], 'cnpj' => ['required', 'cnpj'], 'pis' => ['nullable', 'pis'], 'titulo_eleitor' => ['nullable', 'titulo_eleitor'], 'cnh' => ['nullable', 'cnh'], 'renavam' => ['nullable', 'renavam'], 'placa' => ['nullable', 'placa'], 'cns' => ['nullable', 'cns'], 'chave_pix' => ['nullable', 'pix'], 'cep' => ['required', 'cep'], 'telefone' => ['required', 'phone_br'], 'boleto' => ['required', 'boleto'], 'nfe' => ['required', 'nfe'], ]);
As Rule classes
use LumenSistemas\LaravelBrValidation\Rules\Cpf; use LumenSistemas\LaravelBrValidation\Rules\Pix; $request->validate([ 'cpf' => ['required', new Cpf()], 'chave' => ['required', new Pix(types: ['email', 'phone'])], ]);
Pix accepts an optional types array to restrict accepted
chave PIX types (cpf, cnpj, email, phone, evp); when
omitted, all five types are accepted.
Translations
Messages ship in en and pt_BR. Override per locale by
publishing the language files:
php artisan vendor:publish --tag=laravel-br-validation-lang
Development
composer install
composer test
License
MIT. See LICENSE.
统计信息
- 总下载量: 8
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-05-17