PHPackages                             empinet/laravel-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. empinet/laravel-email-validation

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

empinet/laravel-email-validation
================================

Laravel validation rule for EasyEmailAPI

v1.1.0(1w ago)35051MITPHPPHP ^8.1CI passing

Since Jan 27Pushed 1w agoCompare

[ Source](https://github.com/Empinet/laravel-email-validation)[ Packagist](https://packagist.org/packages/empinet/laravel-email-validation)[ RSS](/packages/empinet-laravel-email-validation/feed)WikiDiscussions master Synced today

READMEChangelog (3)Dependencies (18)Versions (9)Used By (0)

EasyEmailAPI Laravel Validation Rule
====================================

[](#easyemailapi-laravel-validation-rule)

[![CI](https://github.com/Empinet/laravel-email-validation/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/Empinet/laravel-email-validation/actions/workflows/ci.yml)[![Coverage](https://github.com/Empinet/laravel-email-validation/actions/workflows/coverage.yml/badge.svg?branch=master)](https://github.com/Empinet/laravel-email-validation/actions/workflows/coverage.yml)[![Release](https://github.com/Empinet/laravel-email-validation/actions/workflows/release-please.yml/badge.svg?branch=master)](https://github.com/Empinet/laravel-email-validation/actions/workflows/release-please.yml)

Strict email validation for Laravel using EasyEmailAPI.

This package provides a Laravel validation rule that helps detect invalid, disposable, role-based, and risky email addresses before they enter your system. It is designed for sign-up forms, user registration flows, and any place where email quality and deliverability matter.

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

[](#installation)

```
composer require empinet/laravel-email-validation
```

Publish the config file:

```
php artisan vendor:publish --tag=easyemailapi-config
```

Getting an API token
--------------------

[](#getting-an-api-token)

To use this package, you need an API token from EasyEmailAPI. You can create a free account and get your token at

EasyEmailAPI offers a free tier, which is usually enough for testing, small projects, and personal applications.

Set your token in `.env`:

```
EASYEMAILAPI_TOKEN=your-token

```

Usage
-----

[](#usage)

```
use Empinet\EasyEmailApi\Rules\EasyEmailApi;

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

Override defaults per rule instance:

```
new EasyEmailApi([
    'disallow_free' => true,
    'disallow_role' => true,
    'min_score' => 50,
])
```

Configuration
-------------

[](#configuration)

The configuration file is located at `config/easyemailapi.php`. It controls authentication, validation behavior, caching, and fallback handling.

Key settings:

- `token`: API token (from `EASYEMAILAPI_TOKEN`).
- `auth_mode`: `bearer` (default) or `query`.
- `timeout`: Request timeout in seconds.
- `retries`: Number of retries when a request fails.
- `cache.enabled`: Enable response caching.
- `cache.store`: Cache store to use (optional).
- `cache.ttl`: Cache TTL in seconds (default 24 hours).
- `validation.*`: Defaults for response evaluation.
- `fallback.behavior`: `basic_email` (default), `pass`, `fail`, or `exception`.
- `fallback.log`: Enable logging when fallback triggers (default `true`).
- `fallback.log_level`: Log severity for fallback (default `error`).
- `messages.*`: Customize the validation error text returned to users.

Response Evaluation Defaults
----------------------------

[](#response-evaluation-defaults)

The default behavior matches the recommended EasyEmailAPI settings:

- `require_mx` = true
- `disallow_disposable` = true
- `disallow_free` = false
- `disallow_role` = false
- `require_inbox_exists` = false
- `min_score` = 0

These defaults provide strong protection against disposable and invalid email addresses without being overly aggressive.

Caching
-------

[](#caching)

Validation responses are cached per email address and rule options. This prevents repeat calls to the EasyEmailAPI service for the same email and improves performance for high-traffic forms and registration endpoints.

Fallback Behavior
-----------------

[](#fallback-behavior)

When the EasyEmailAPI service is unavailable, the rule will apply the configured fallback strategy:

- `basic_email`: fall back to Laravel's built-in `email` rule.
- `pass`: allow validation to pass.
- `fail`: fail validation.
- `exception`: throw `EasyEmailApiException`.

This allows you to balance strict validation against availability requirements.

Testing
-------

[](#testing)

```
composer install
vendor/bin/phpunit
```

About EasyEmailAPI
==================

[](#about-easyemailapi)

This package is powered by [EasyEmailAPI](https://easyemailapi.com)￼, a real-time email validation service built to help developers prevent fake sign-ups, disposable email abuse, and invalid addresses before they reach the database. EasyEmailAPI goes beyond basic syntax checks by validating MX records, detecting temporary and disposable email providers, and assessing overall email risk, making it ideal for modern applications that care about data quality, deliverability, and protecting registration flows from spam and automated abuse.

###  Health Score

39

—

LowBetter than 84% of packages

Maintenance87

Actively maintained with recent releases

Popularity21

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity33

Early-stage or recently created project

 Bus Factor1

Top contributor holds 71.4% 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 ~74 days

Total

3

Last Release

8d ago

Major Versions

v0.2.0 → v1.0.02026-06-02

PHP version history (2 changes)v0.2.0PHP ^8.0

v1.0.0PHP ^8.1

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/12988865?v=4)[Mahdi Hazaveh](/maintainers/hazaveh)[@hazaveh](https://github.com/hazaveh)

---

Top Contributors

[![hazaveh](https://avatars.githubusercontent.com/u/12988865?v=4)](https://github.com/hazaveh "hazaveh (15 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (3 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (3 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/empinet-laravel-email-validation/health.svg)

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

###  Alternatives

[laravel/mcp

Rapidly build MCP servers for your Laravel applications.

77022.3M151](/packages/laravel-mcp)[psalm/plugin-laravel

Psalm plugin for Laravel

3355.3M346](/packages/psalm-plugin-laravel)[spatie/laravel-honeypot

Preventing spam submitted through forms

1.6k6.8M75](/packages/spatie-laravel-honeypot)[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9762.4M131](/packages/roots-acorn)[illuminate/auth

The Illuminate Auth package.

10528.2M1.2k](/packages/illuminate-auth)[api-platform/laravel

API Platform support for Laravel

58171.4k14](/packages/api-platform-laravel)

PHPackages © 2026

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