PHP code example of carabidaee / validators

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

    

carabidaee / validators example snippets


$emailsList = [
    '[email protected]',
    // ... list of emails
];

$emailValidator = new EmailValidator();
$emailValidator->checkMXRecords = false; // Disabling verification of MX records

if (!$emailValidator->validate($emailsList)) {
    foreach ($emailValidator->getErrors() as $error) {
        echo "Email {$error['email']} incorrect: {$error['errorText']}\n";
    }
}

foreach ((array) $emailValidator->getCorrectEmails() as $email) {
    echo "Email {$email} correct\n"; 
}