aman00323/emailchecker 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

aman00323/emailchecker

Composer 安装命令:

composer require aman00323/emailchecker

包简介

Laravel package for checking email address is exist or not in real world

README 文档

README

GitHub license GitHub release Packagist Downloads PHP Version codecov

Email Checker helps you reduce fake signups and disposable email usage by validating addresses with a practical multi-step flow.

Why Use It

  • disposable-domain detection
  • MX/DNS checks
  • SMTP probe (when possible)

Use it in registration and lead-capture flows where cleaner email data matters.

Quick Start

Install:

composer require aman00323/emailchecker

Basic check:

use Aman\EmailVerifier\EmailChecker;

$result = app(EmailChecker::class)->checkEmail('user@example.com', true);

if ($result['success']) {
	// Use $result['disposable'], $result['mxrecord'], $result['domain']
} else {
	// Use $result['error']
}

Compatibility

Package Version PHP Laravel
3.x >= 8.1 10.x, 11.x, 12.x

Installation

Email Checker requires PHP >= 8.1 and supports modern Laravel versions.

To get the latest version, require the project using Composer:

composer require aman00323/emailchecker

Once installed, include Aman\EmailVerifier\EmailChecker to access validation methods.

Optional: publish package config to tune SMTP behavior globally:

php artisan vendor:publish --tag=emailchecker-config

This creates config/emailchecker.php with defaults for probe toggle, port, timeout, and sender email.

Configuration

Published config (config/emailchecker.php) example:

<?php

return [
    'smtp_probe' => env('EMAIL_CHECKER_SMTP_PROBE', true),
    'smtp_port' => (int) env('EMAIL_CHECKER_SMTP_PORT', 25),
    'smtp_timeout_seconds' => (int) env('EMAIL_CHECKER_SMTP_TIMEOUT_SECONDS', 5),
    'from_email' => env('EMAIL_CHECKER_SET_FROM', 'example@example.com'),
];

Use global config when:

  • you want one default behavior across the whole Laravel app
  • settings should come from environment variables per deployment

Use per-instance setters when:

  • you need request-specific behavior
  • you want to override defaults for one check flow only
$checker = app(EmailChecker::class);

$checker
    ->setSmtpProbeEnabled(false)
    ->setSmtpPort(2525)
    ->setSmtpTimeoutSeconds(10)
    ->setFromEmail('ops@example.com');

Usage

Check Disposable Emails

If you want to check whether an email is disposable, use the method below.

Pass true as the second argument to enable deep checking against the full disposable-domain dataset shipped in this package.

app(EmailChecker::class)->checkDisposableEmail('something@example.com', true);

This checks the address domain against the disposable-domain dataset included in this package.

Check DNS and MX Records

For better SMTP responses, set a sender email first:

app(EmailChecker::class)->setFromEmail('something@example.com');

Or set an environment variable:

EMAIL_CHECKER_SET_FROM='something@example.com'

You can also configure probe behavior globally via environment variables:

EMAIL_CHECKER_SMTP_PROBE=true
EMAIL_CHECKER_SMTP_PORT=25
EMAIL_CHECKER_SMTP_TIMEOUT_SECONDS=5

This method checks DNS and MX records, then attempts an SMTP handshake using fsockopen().

app(EmailChecker::class)->checkMxAndDnsRecord('something@example.com');

This returns an array like ['valid'|'invalid', 'details...'].

For better output, your server should support fsockopen().

Check Domain Status

This method validates domain existence through DNS record checks (MX, A, AAAA, CNAME).

app(EmailChecker::class)->checkDomain('something@example.com');

This method returns true when at least one supported DNS record exists; otherwise false.

Check Email

This method runs disposable, MX/DNS+SMTP, and domain checks and returns a structured response.

app(EmailChecker::class)->checkEmail('something@example.com', true);

All methods can be used independently, or together via checkEmail().

Example success response:

[
    'success' => true,
    'disposable' => ['success' => true, 'detail' => 'Email address is not disposable'],
    // Legacy key, kept for backward compatibility:
    'dispossable' => ['success' => true, 'detail' => 'Email address is not disposable'],
    'mxrecord' => ['success' => true, 'detail' => 'Valid email address'],
    'domain' => ['success' => true, 'detail' => 'Domain exists.'],
]

Limits and Expectations

No email verification library can guarantee 100% certainty for every mailbox.

  • Some mail servers block SMTP probes
  • Some domains are valid but intentionally restrictive
  • Disposable-domain providers change frequently

Use this package as a high-signal filter, not a single source of truth.

Deprecations and Migration Notes

The package keeps old keys/properties for compatibility, but new integrations should use corrected names.

Legacy Use Instead Status
dispossable (response key) disposable Deprecated, still returned
$checker->domian $checker->domain Deprecated, still synchronized

Migration recommendation:

  • read disposable in new code
  • keep fallback support for dispossable in existing clients until your next major release

Contribution

All contributors are welcome. Please keep code style consistent and ensure tests pass before opening a pull request.

Keeping Disposable Domains Updated

Refresh the domain dataset locally:

composer update-disposable-domains

This command fetches trusted source lists, normalizes and deduplicates domains, rewrites shard files in resources/domains, and updates resources/domains/metadata.json.

The repository also includes a daily scheduled GitHub Actions workflow to automate refreshes and open pull requests when updates are available.

Sponsorship and Commercial Support

If this package saves your team time or prevents signup abuse in production, please consider supporting maintenance.

  • Sponsor ongoing open-source maintenance
  • Fund roadmap items and faster issue triage
  • Request paid integration support for your project

For sponsorship or paid support, contact: aman.gopher@gmail.com

Credits

Thanks to all contributors and users who helped this package reach broad production usage.

aman00323/emailchecker 适用场景与选型建议

aman00323/emailchecker 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 63.76k 次下载、GitHub Stars 达 158, 最近一次更新时间为 2019 年 08 月 23 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「email validation」 「email verification」 「disposable email checker」 「php email verifier」 「email exist or not」 「disposable emails」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 aman00323/emailchecker 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 aman00323/emailchecker 我们能提供哪些服务?
定制开发 / 二次开发

基于 aman00323/emailchecker 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 63.76k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 160
  • 点击次数: 34
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 158
  • Watchers: 6
  • Forks: 34
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-08-23