PHP code example of ricardosierra / validate

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

    

ricardosierra / validate example snippets




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



\Validate\Password::validate('RHMVbymY45JWar5A'); // True
\Validate\Password::validate('3?=4dB#%zNGaXH_P'); // True
\Validate\Password::validate('123456'); // False
\Validate\Password::validate('Ricardo'); // False



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('[email protected]');

// Email to check
$email = '[email protected]'; 

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