PHP code example of mattketmo / email-checker

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

    

mattketmo / email-checker example snippets




mailChecker\EmailChecker;

$checker = new EmailChecker();

$checker->isValid('[email protected]');     // true
$checker->isValid('[email protected]'); // false



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;
}

EmailChecker\Laravel\EmailCheckerServiceProvider::class

'EmailChecker' => EmailChecker\Laravel\EmailCheckerFacade::class



class MyClass
{
	public function foo()
	{
        // Facade Access
        EmailChecker::isValid('[email protected]');

        // Container Access
        $checker = app()->make('email.checker');
        $checker->isValid('[email protected]');
    }

    public function getValidator(array $data)
    {
        // Not thow away validator
        return Validator::make($data, [
    	     'email' => '