PHPackages                             eg-mohamed/email-validation - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Validation &amp; Sanitization](/categories/validation)
4. /
5. eg-mohamed/email-validation

ActiveLibrary[Validation &amp; Sanitization](/categories/validation)

eg-mohamed/email-validation
===========================

A comprehensive Laravel package for advanced email validation combining RFC compliance checks, DNS/MX record verification, and disposable email detection.

v1.1.1(5mo ago)028MITPHPPHP ^8.3CI passing

Since Dec 2Pushed 5mo agoCompare

[ Source](https://github.com/EG-Mohamed/Email-validation)[ Packagist](https://packagist.org/packages/eg-mohamed/email-validation)[ Docs](https://github.com/eg-mohamed/email-validation)[ GitHub Sponsors](https://github.com/eg-mohamed)[ RSS](/packages/eg-mohamed-email-validation/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (14)Versions (12)Used By (0)

Email Validation for Laravel
============================

[](#email-validation-for-laravel)

[![Latest Version on Packagist](https://camo.githubusercontent.com/7819fe6f3dbe1c9d44f2dffe6dd085e752b9a55b108a1cfbb8272c3778257b16/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f65672d6d6f68616d65642f656d61696c2d76616c69646174696f6e2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/eg-mohamed/email-validation)[![GitHub Tests Action Status](https://camo.githubusercontent.com/e5038fcaba0b9f6897ce75beeef779d25f3f71594e77840b46ff71582e74ec03/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f65672d6d6f68616d65642f656d61696c2d76616c69646174696f6e2f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/eg-mohamed/email-validation/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/0cd4859ea9c42d10cb8ea8655dddb0538610ff41a743cea60a696875ed594c21/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f65672d6d6f68616d65642f656d61696c2d76616c69646174696f6e2f6669782d7068702d636f64652d7374796c652d6973737565732e796d6c3f6272616e63683d6d61696e266c6162656c3d636f64652532307374796c65267374796c653d666c61742d737175617265)](https://github.com/eg-mohamed/email-validation/actions?query=workflow%3A%22Fix+PHP+code+style+issues%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/270b3fc1158299269054c0a7384836780788f0215d88850d2d2cf648b6957949/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f65672d6d6f68616d65642f656d61696c2d76616c69646174696f6e2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/eg-mohamed/email-validation)

A comprehensive Laravel package for advanced email validation combining RFC compliance checks, DNS/MX record verification, and disposable email detection. Built on top of `egulias/email-validator` and `propaganistas/laravel-disposable-email`.

Features
--------

[](#features)

- **RFC Syntax Validation**: Validates email format against RFC 5321, 5322, 6530, 6531, 6532, and 1035
- **DNS/MX Record Verification**: Checks if the email domain has valid MX records
- **Disposable Email Detection**: Blocks temporary/disposable email providers
- **Configurable Validations**: Enable/disable specific validation checks via config
- **Custom Error Messages**: Customize validation error messages
- **Facade Support**: Easy access via Laravel facade

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require eg-mohamed/email-validation
```

Optionally, you can publish the config file with:

```
php artisan vendor:publish --tag="email-validation-config"
```

This is the contents of the published config file:

```
return [
    'validations' => [
        'syntax' => true,
        'dns' => true,
        'disposable' => true,
    ],
];
```

You can also publish the translations:

```
php artisan vendor:publish --tag="email-validation-translations"
```

The package includes English and Arabic translations by default.

Usage
-----

[](#usage)

### Using the Validation Rule

[](#using-the-validation-rule)

You can use the `email_validation` rule in your validation rules:

```
use Illuminate\Http\Request;

public function store(Request $request)
{
    $validated = $request->validate([
        'email' => ['required', 'email_validation'],
    ]);
}
```

### Using the Rule Class

[](#using-the-rule-class)

You can also use the rule class directly:

```
use MohamedSaid\EmailValidation\Rules\EmailValidationRule;

$request->validate([
    'email' => ['required', new EmailValidationRule()],
]);
```

### Using the Facade

[](#using-the-facade)

The package provides a facade for programmatic validation:

```
use MohamedSaid\EmailValidation\Facades\EmailValidation;

if (EmailValidation::isValid('user@example.com')) {
    // Email is valid
}

$results = EmailValidation::validate('user@example.com');

$failures = EmailValidation::getFailures('user@example.com');
```

### Configuration

[](#configuration)

You can control which validations are performed by modifying the config file:

```
return [
    'validations' => [
        'syntax' => true,      // RFC syntax validation
        'dns' => true,         // DNS/MX record check
        'disposable' => true,  // Disposable email detection
    ],
];
```

### Custom Error Messages

[](#custom-error-messages)

Customize the error messages by publishing and editing the translation files:

**English (lang/en/email-validation.php):**

```
return [
    'syntax' => 'The :attribute must be a valid email address.',
    'dns' => 'The :attribute domain does not have valid MX records.',
    'disposable' => 'Disposable email addresses are not allowed.',
];
```

**Arabic (lang/ar/email-validation.php):**

```
return [
    'syntax' => 'يجب أن يكون :attribute عنوان بريد إلكتروني صالح.',
    'dns' => 'نطاق :attribute لا يحتوي على سجلات MX صالحة.',
    'disposable' => 'عناوين البريد الإلكتروني المؤقتة غير مسموح بها.',
];
```

Validation Order
----------------

[](#validation-order)

Validations are performed in the following order for optimal performance:

1. **Syntax validation** (fastest)
2. **Disposable email check** (medium)
3. **DNS/MX verification** (slowest)

The validation stops at the first failure to minimize processing time.

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [Mohamed Said](https://github.com/eg-mohamed)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

39

—

LowBetter than 85% of packages

Maintenance77

Regular maintenance activity

Popularity7

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

11

Last Release

157d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/23424932?v=4)[Mohamed Said](/maintainers/EG-Mohamed)[@EG-Mohamed](https://github.com/EG-Mohamed)

---

Top Contributors

[![EG-Mohamed](https://avatars.githubusercontent.com/u/23424932?v=4)](https://github.com/EG-Mohamed "EG-Mohamed (18 commits)")

---

Tags

laravelemail validationeg-mohamed

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/eg-mohamed-email-validation/health.svg)

```
[![Health](https://phpackages.com/badges/eg-mohamed-email-validation/health.svg)](https://phpackages.com/packages/eg-mohamed-email-validation)
```

###  Alternatives

[proengsoft/laravel-jsvalidation

Validate forms transparently with Javascript reusing your Laravel Validation Rules, Messages, and FormRequest

1.1k2.3M49](/packages/proengsoft-laravel-jsvalidation)[stevebauman/purify

An HTML Purifier / Sanitizer for Laravel

5325.6M19](/packages/stevebauman-purify)[axlon/laravel-postal-code-validation

Worldwide postal code validation for Laravel and Lumen

3853.3M1](/packages/axlon-laravel-postal-code-validation)[vormkracht10/laravel-mails

Laravel Mails can collect everything you might want to track about the mails that has been sent by your Laravel app.

24149.7k](/packages/vormkracht10-laravel-mails)[ziming/laravel-zxcvbn

Zxcvbn Password validation rule for Laravel

3056.7k](/packages/ziming-laravel-zxcvbn)[laravel-validation-rules/phone

Validate that a phone number is in the correct format

69355.5k](/packages/laravel-validation-rules-phone)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
