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

v0.2.0(3mo ago)3130MITPHPPHP ^8.0CI passing

Since Jan 27Pushed 3mo 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 1mo ago

READMEChangelog (1)Dependencies (9)Versions (3)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.yml/badge.svg?branch=master)](https://github.com/Empinet/laravel-email-validation/actions/workflows/release.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

35

—

LowBetter than 80% of packages

Maintenance80

Actively maintained with recent releases

Popularity17

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity30

Early-stage or recently created project

 Bus Factor1

Top contributor holds 91.7% 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

Unknown

Total

1

Last Release

105d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/87c0c49081a79a456bf9730ec426e840236cf7ed3ef0596fe31f62c45b0fcf38?d=identicon)[hazaveh](/maintainers/hazaveh)

---

Top Contributors

[![hazaveh](https://avatars.githubusercontent.com/u/12988865?v=4)](https://github.com/hazaveh "hazaveh (11 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (1 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

[spatie/laravel-honeypot

Preventing spam submitted through forms

1.6k6.0M60](/packages/spatie-laravel-honeypot)[propaganistas/laravel-phone

Adds phone number functionality to Laravel based on Google's libphonenumber API.

3.0k35.7M107](/packages/propaganistas-laravel-phone)[proengsoft/laravel-jsvalidation

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

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

Rapidly build MCP servers for your Laravel applications.

71510.9M66](/packages/laravel-mcp)[axlon/laravel-postal-code-validation

Worldwide postal code validation for Laravel and Lumen

3853.3M1](/packages/axlon-laravel-postal-code-validation)[wendelladriel/laravel-validated-dto

Data Transfer Objects with validation for Laravel applications

759569.4k13](/packages/wendelladriel-laravel-validated-dto)

PHPackages © 2026

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