1. Go to this page and download the library: Download suprvise/email-checker 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/ */
use EmailChecker\EmailChecker;
use EmailChecker\Adapter;
$checker = new EmailChecker(new Adapter\ArrayAdapter(array(
'foo.org',
'baz.net'
)));
$checker->isValid('[email protected]'); // true
$checker->isValid('[email protected]'); // false
use EmailChecker\Constraints as EmailCheckerAssert;
use Symfony\Component\Validator\Constraints as Assert;
class User
{
/**
* @Assert\NotBlank
* @EmailCheckerAssert\NotThrowawayEmail
*/
protected $email;
}