Skip to the content.

Validador de Campos PHP

Scrutinizer Code Quality Code Coverage

Latest Stable Version Total Downloads Latest Unstable Version License

Esse pacote te da um validator em php puro para diferentes tipos de campos.

Requirementos:

Instalando

Você pode instalar esse biblioteca via compose: composer require ricardosierra/validate

Exemplos

Validando Nomes Completos

<?php

\Validate\Name::validate('Ricardo Sierra'); // True
\Validate\Name::validate('Ricardo'); // False
\Validate\Name::validate('Ricardo 123'); // False
\Validate\Name::validate('Teste Sierra'); // False

Validando Emails

<?php

use Validate\Email;

// Initialize library class
$mail = new Email();

// Set the timeout value on stream
$mail->setStreamTimeoutWait(20);

// Set debug output mode
$mail->Debug= TRUE; 
$mail->Debugoutput= 'html'; 

// Set email address for SMTP request
$mail->setEmailFrom('from@email.com');

// Email to check
$email = 'email@example.com'; 

// Check if email is valid and exist
if($mail->check($email)){ 
    echo 'Email &lt;'.$email.'&gt; is exist!'; 
}elseif(Email::validate($email)){ 
    echo 'Email &lt;'.$email.'&gt; is valid, but not exist!'; 
}else{ 
    echo 'Email &lt;'.$email.'&gt; is not valid and not exist!'; 
} 

?>

Contribuindo

For contributing guidelines, please see CONTRIBUTING.md

Créditos