<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
daveearley / daves-email-validation-tool example snippets
// Include the composer autoloader
lValidatorFactory::create('[email protected]');
$jsonResult = $validator->getValidationResults()->asJson();
$arrayResult = $validator->getValidationResults()->asArray();
echo $jsonResult;
namespace EmailValidation\Validations;
class GmailValidator extends Validator
{
public function getValidatorName(): string
{
return 'is_gmail';
}
public function getResultResponse(): bool
{
$hostName = $this->getEmailAddress()->getHostPart();
return strpos($hostName, 'gmail.com') !== false;
}
}
use EmailValidation\Validations\GmailValidator;
eate('[email protected]');
$validator->registerValidator(new GmailValidator());
echo $validator->getValidationResults()->asJson();
declare(strict_types=1);
namespace EmailValidation;
class CustomEmailDataProvider implements EmailDataProviderInterface
{
public function getEmailProviders(): array
{
return ['custom.com'];
}
public function getTopLevelDomains(): array
{
return ['custom'];
}
public function getDisposableEmailProviders(): array
{
return ['custom.com', 'another.com'];
}
public function getRoleEmailPrefixes(): array
{
return ['custom'];
}
}