PHPackages                             jojostx/laravel-elasticemail - 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. [Mail &amp; Notifications](/categories/mail)
4. /
5. jojostx/laravel-elasticemail

ActiveLibrary[Mail &amp; Notifications](/categories/mail)

jojostx/laravel-elasticemail
============================

A lightweight Laravel package for validating emails using the ElasticEmail API.

v1.0(3y ago)06MITPHPPHP ^8.0|^8.1

Since Jan 9Pushed 3y ago1 watchersCompare

[ Source](https://github.com/jojostx/laravel-elasticemail)[ Packagist](https://packagist.org/packages/jojostx/laravel-elasticemail)[ Docs](https://github.com/jojostx/laravel-elasticemail)[ GitHub Sponsors](https://github.com/jojostx)[ RSS](/packages/jojostx-laravel-elasticemail/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (6)Versions (2)Used By (0)

Table of Contents
-----------------

[](#table-of-contents)

- [Overview](#overview)
- [Installation](#installation)
    - [Requirements](#requirements)
    - [Install the Package](#install-the-package)
    - [Publish the Config](#publish-the-config)
    - [Getting Your ElasticEmail API Key](#getting-your-elasticemail-api-key)
- [Usage](#usage)
    - [Methods](#methods)
        - [Validating One Email Address](#validating-one-email-address)
        - [Validating Multiple Email Addresses](#validating-multiple-email-addresses)
    - [Facade](#facade)
    - [Available Validation Result Properties](#available-validation-result-properties)
    - [Caching](#caching)
        - [Caching Validation Results](#caching-validation-results)
        - [Busting the Cached Validation Results](#busting-the-cached-validation-results)
- [Testing](#testing)
- [Security](#security)
- [Contribution](#contribution)
- [Credits](#credits)
- [Changelog](#changelog)
- [License](#license)

Overview
--------

[](#overview)

Laravel ElasticEmail is a lightweight wrapper Laravel package that can be used for validating email addresses via the [ElasticEmail API](https://elasticemail.com/). The package supports caching so that you can start validating email addresses instantly.

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

[](#installation)

### Requirements

[](#requirements)

The package has been developed and tested to work with the following minimum requirements:

- PHP 8.0+
- Laravel 8+

### Install the Package

[](#install-the-package)

You can install the package via Composer:

```
composer require jojostx/laravel-elasticemail
```

### Publish the Config

[](#publish-the-config)

You can then publish the package's config file (so that you can make changes to them) by using the following command:

```
php artisan vendor:publish --provider="Jojostx\ElasticEmail\Providers\ElasticEmailProvider"
```

### Getting Your ElasticEmail API Key

[](#getting-your-elasticemail-api-key)

To use this package and interact with the ElasticEmail API, you'll need to register on the [ElasticEmail API](https://elasticemail.com/)website and get your API key. Once you have the key, you can set it in your `.env` file as shown below:

```
ElasticEmail_API_KEY=your-api-key-here

```

Usage
-----

[](#usage)

### Methods

[](#methods)

#### Validating One Email Address

[](#validating-one-email-address)

To validate a single email address, you can use the `check()` method that is provided in the package. This method returns a `ValidationResult` object.

The example below shows how to validate a single email address:

```
use Jojostx\ElasticEmail\Classes\ElasticEmail;

$ElasticEmail = new ElasticEmail('api-key-here');
$validationResult = $ElasticEmail->check('example@domain.com');
```

#### Validating Multiple Email Addresses

[](#validating-multiple-email-addresses)

To validate multiple email addresses, you can use the `checkMany()` method that is provided in the package. This method returns a `Collection` of `ValidationResult` objects.

The example below shows how to validate multiple email addresses:

```
use Jojostx\ElasticEmail\Classes\ElasticEmail;

$ElasticEmail = new ElasticEmail('api-key-here');
$validationResults = $ElasticEmail->checkMany(['example@domain.com', 'test@test.com']);
```

### Facade

[](#facade)

If you prefer to use facades in Laravel, you can choose to use the provided `ElasticEmail` facade instead of instantiating the `Jojostx\ElasticEmail\Classes\ElasticEmail`class manually.

The example below shows an example of how you could use the facade to validate an email address:

```
use ElasticEmail;

return ElasticEmail::check('example@domain.com');
```

### Available Validation Result Properties

[](#available-validation-result-properties)

FieldDescriptionemailThe email address that the validation was carried out on.suggestedSpellingA suggested email address in case a typo was detected.accountThe local part of the email address. Example: 'mail' in ''.domainThe domain part of the email address. Example: 'jojostx.co.uk' in ''.roleWhether or not the requested email is a role email address. Example: ''.disposableWhether or not the requested email is disposable. Example: ''.reasonA short description for the result of the check.resultAn enum (`Jojostx\ElasticEmail\Enums\EmailValidationStatus`) representing the value of the check. \['Valid', 'Invalid', 'Risky', 'Unknown', 'None'\]addedAtA `Carbon` object containing the date and time that the original validation API request was made.### Caching

[](#caching)

#### Caching Validation Results

[](#caching-validation-results)

There might be times when you want to cache the validation results for an email. This can have significant performance benefits for if you try to validate the email again, due to the fact that the results will be fetched from the cache rather than from a new API request.

As an example, if you were importing a CSV containing email addresses, you might want to validate each of the addresses. However, if the CSV contains some duplicated email addresses, it could lead to unnecessary API calls being made. So, by using the caching, each unique address would only be fetched once from the API. To do this, you can use the `shouldCache()` method.

Using caching is recommended as it reduces the chances of you reaching the monthly request limits or rate limits that are used by ElasticEmail. Read more about the [API limits here](https://elasticemail.com/documentation#rate_limits).

The example below shows how to cache the validation results:

```
use Jojostx\ElasticEmail\Classes\ElasticEmail;

$ElasticEmail = new ElasticEmail('api-key-here');

// Result fetched from the API.
$validationResults = $ElasticEmail->shouldCache()->check('example@domain.com');

// Result fetched from the cache.
$validationResults = $ElasticEmail->shouldCache()->check('example@domain.com');
```

#### Busting the Cached Validation Results

[](#busting-the-cached-validation-results)

By default, the package will always try to fetch the validation results from the cache before trying to fetch them via the API. As mentioned before, this can lead to multiple performance benefits.

However, there may be times that you want to ignore the cached results and make a new request to the API. As an example, you might have a cached validation result that is over 6 months old and could possibly be outdated or inaccurate, so it's likely that you want to update the validation data and ensure it is correct. To do this, you can use the `fresh()` method.

The example below shows how to fetch a new validation result:

```
use Jojostx\ElasticEmail\Classes\ElasticEmail;

$ElasticEmail = new ElasticEmail('api-key-here');

$validationResults = $ElasticEmail->fresh()->check('example@domain.com');
```

Testing
-------

[](#testing)

```
vendor/bin/phpunit
```

Security
--------

[](#security)

If you find any security related issues, please contact me directly at [Jojostx](ikuskid7@gmail.com) to report it.

Contribution
------------

[](#contribution)

If you wish to make any changes or improvements to the package, feel free to make a pull request.

To contribute to this library, please use the following guidelines before submitting your pull request:

- Write tests for any new functions that are added. If you are updating existing code, make sure that the existing tests pass and write more if needed.
- Follow [PSR-2](https://www.php-fig.org/psr/psr-2/) coding standards.
- Make all pull requests to the `master` branch.

Credits
-------

[](#credits)

- [Jojostx](ikuskid7@gmail.com)
- [All Contributors](https://github.com/jojostx/laravel-elasticemail/graphs/contributors)

Changelog
---------

[](#changelog)

Check the [CHANGELOG](CHANGELOG.md) to get more information about the latest changes.

License
-------

[](#license)

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

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity54

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 94.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

Unknown

Total

1

Last Release

1225d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/5704d6efaccea9b264c37e3ba1d2b7401c7d1de25b5c357bb687bcf4b918f9b3?d=identicon)[jojostx](/maintainers/jojostx)

---

Top Contributors

[![ash-jc-allen](https://avatars.githubusercontent.com/u/39652331?v=4)](https://github.com/ash-jc-allen "ash-jc-allen (51 commits)")[![peter279k](https://avatars.githubusercontent.com/u/9021747?v=4)](https://github.com/peter279k "peter279k (2 commits)")[![jojostx](https://avatars.githubusercontent.com/u/42269899?v=4)](https://github.com/jojostx "jojostx (1 commits)")

---

Tags

laravelvalidationemaillaravel-packageelasticemailjojostx

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/jojostx-laravel-elasticemail/health.svg)

```
[![Health](https://phpackages.com/badges/jojostx-laravel-elasticemail/health.svg)](https://phpackages.com/packages/jojostx-laravel-elasticemail)
```

###  Alternatives

[erag/laravel-disposable-email

A Laravel package to detect and block disposable email addresses.

226102.4k](/packages/erag-laravel-disposable-email)[ashallendesign/laravel-mailboxlayer

A lightweight Laravel package for validating emails using the Mailbox Layer API.

762.0k](/packages/ashallendesign-laravel-mailboxlayer)[kouz/laravel-mailgun-email-validation

Laravel email validation that uses the Mailgun API for a three-step validation check.

11141.0k1](/packages/kouz-laravel-mailgun-email-validation)[martian/spammailchecker

A laravel package that protect users from entering non-existing/spam email addresses.

422.0k](/packages/martian-spammailchecker)

PHPackages © 2026

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