PHP code example of laravellegends / pt-br-validator

1. Go to this page and download the library: Download laravellegends/pt-br-validator library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

laravellegends / pt-br-validator example snippets


'providers' => [
    // ... outros pacotes
    LaravelLegends\PtBrValidator\ValidatorProvider::class
]


$validator = \Validator::make(
    ['telefone' => '(77)9999-3333'],
    ['telefone' => '


use Illuminate\Http\Request;

// URL: /testando?telefone=3455-1222

Route::get('testando', function (Request $request) {

    try{

        $dados = $request->validate([
            'telefone' => '

Validator::make($valor, $regras, ['celular_com_ddd' => 'O campo :attribute não é um celular'])

public function messages() {

    return [
        'campo.telefone' => 'Telefone não válido!'
    ];
}

use Illuminate\Http\Request;
use LaravelLegends\PtBrValidator\Rules\FormatoCpf;

// testando?cpf=valor_invalido

Route::get('testando', function (Request $request) {

    try{

        $dados = $request->validate([
            'cpf'  => ['