PHP code example of ashvedov / email-validator

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

    

ashvedov / email-validator example snippets


use Src\EmailValidator;

$validator = new EmailValidator(
    emails: [
        '[email protected]',
        '[email protected]',
        '[email protected]',
        '[email protected]',
        '[email protected]',
        '[email protected]',
        '[email protected]',
        '[email protected]',
        23,
        '[email protected]'
    ]
);
var_dump($validator->validate()->toArray());

array(3) {
  [23]=>
  array(4) {
    [0]=>
    string(17) "filter_var_errors"
    [1]=>
    string(12) "regex_errors"
    [2]=>
    string(16) "mx_record_errors"
    [3]=>
    string(22) "world_mx_record_errors"
  }
  ["[email protected]"]=>
  array(2) {
    [0]=>
    string(16) "mx_record_errors"
    [1]=>
    string(22) "world_mx_record_errors"
  }
  ["[email protected]"]=>
  array(2) {
    [0]=>
    string(16) "mx_record_errors"
    [1]=>
    string(22) "world_mx_record_errors"
  }
}