PHP code example of usinatech / br-validator

1. Go to this page and download the library: Download usinatech/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/ */

    

usinatech / br-validator example snippets



$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!'
    ];
}