1. Go to this page and download the library: Download ichinya/mail-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/ */
ichinya / mail-validator example snippets
use Ichinya\MailValidator\Validator;
if (Validator::validate('[email protected]')){
echo 'Email valid';
} else {
echo 'Email INVALID!';
}
// create new class
class NewConfig extends \Ichinya\MailValidator\Config
{
protected bool $useException = false;
// clear standard purifications classes
protected array $standardPurifications = [];
}
// use config
\Ichinya\MailValidator\Validator::setConfig(new NewCofig());
// use validator
if (Validator::validate('[email protected]')){
echo 'Email valid';
} else {
echo 'Email INVALID!';
}
use \Ichinya\MailValidator\Validator;
use \Ichinya\MailValidator\Config;
// set config
$config = newConfig();
$config->addChecker(\Ichinya\MailValidator\Checkers\RegExChecker::class);
$config->addCustomPurification(fn($value) => trim($value));
// use config
Validator::setConfig($config);
// use validator
if (Validator::validate('[email protected]')){
echo 'Email valid';
} else {
echo 'Email INVALID!';
}