damirco/emailcheck
Composer 安装命令:
composer require damirco/emailcheck
包简介
Validates email addresses
README 文档
README
PHP library for validating email addresses via regex syntax check and DNS MX lookup.
Requirements
- PHP 8.3+
Installation
composer require damirco/emailcheck
Usage
Single email
use Damirco\Emailcheck\Email; $email = new Email('user@example.com'); $email->isSyntaxValid(); // true — regex check $email->isMxValid(); // true — DNS MX lookup $email->isValid(); // true — both checks pass (string) $email; // 'user@example.com'
Batch validation
use Damirco\Emailcheck\EmailSet; $set = new EmailSet([ 'user@example.com', 'invalid', 'admin@gmail.com', ]); // Both syntax + MX $result = $set->check(); // ['valid' => ['user@example.com', 'admin@gmail.com'], 'invalid' => ['invalid']] // Syntax only (no DNS) $result = $set->checkSyntax(); // MX only (no syntax) $result = $set->checkMxRecords(); // Custom: syntax only, skip MX $result = $set->check(check_syntax: true, check_mx: false);
EmailSet deduplicates input and filters non-string values automatically.
Testing
composer test
License
统计信息
- 总下载量: 0
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 5
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-07-04