PHP code example of lucasgiovanny / laravel-serpro-datavalid

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

    

lucasgiovanny / laravel-serpro-datavalid example snippets


use  LucasGiovanny\SerproDataValid\Person;

use  LucasGiovanny\SerproDataValid\Person;

$data = [
'nome'  =>  "João da Silva",
'sexo' => 'M'
'situacao_cpf'  =>  'regular',
];

$validation = Person::rawValidation("00000000000", $data);

use  LucasGiovanny\SerproDataValid\Person;

$validation = Person::validateName("00000000000", "João da Silva");
//return true or false;
$validation = Person::validateName("00000000000", "João da Silva", true);
//return an object, like:
	// $validation->nome = true;
	// $validation->nome_similaridade = 0.99

use  LucasGiovanny\SerproDataValid\Person;

$validation = Person::validateGender("00000000000", "F"); // gender needs to be "F" or "M"
//return true or false;

use  LucasGiovanny\SerproDataValid\Person;

$validation = Person::isBrazilian("00000000000");
//return true or false;

use  LucasGiovanny\SerproDataValid\Person;

$parents = [
	'mother_name' => 'Eurica Magalhães Souza';
	'father_name' => 'Frederico Fagundes Souza';
]; // you can check just one of the names

$validation = Person::validateParentsName("00000000000", $parents);
//return an object with "mother_name" and "father_name" true or false values;

$validation = Person::validateParentsName("00000000000", $parents, true);
//return an object with "mother_name" and "father_name" true or false values, 
//and "mother_name_similarity" and "father_name_similarity" numbers,
//just like in validateName method.

use  LucasGiovanny\SerproDataValid\Person;

$validation = Person::isCPFRegular("00000000000");
//return true or false;

use  LucasGiovanny\SerproDataValid\Person;

$validation = Person::validatePhoto("00000000000", base64_encode($photo));
//return true or false;