PHPackages                             elbgoods/laravel-trashmail-rule - 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. elbgoods/laravel-trashmail-rule

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

elbgoods/laravel-trashmail-rule
===============================

Laravel validation rule to prevent trashmail email addresses.

1.1(3y ago)98.1k2[1 issues](https://github.com/elbgoods/laravel-trashmail-rule/issues)MITPHPPHP ^8.0

Since Feb 17Pushed 3y ago2 watchersCompare

[ Source](https://github.com/elbgoods/laravel-trashmail-rule)[ Packagist](https://packagist.org/packages/elbgoods/laravel-trashmail-rule)[ Docs](https://github.com/elbgoods/laravel-trashmail-rule)[ RSS](/packages/elbgoods-laravel-trashmail-rule/feed)WikiDiscussions master Synced yesterday

READMEChangelog (10)Dependencies (6)Versions (12)Used By (0)

Laravel Trashmail Rules
=======================

[](#laravel-trashmail-rules)

[![Latest Version](https://camo.githubusercontent.com/d55c048b1880f9ec2c1db7930c64c330a7c94a0798bb5dcf95124a1b7226f014/687474703a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f656c62676f6f64732f6c61726176656c2d74726173686d61696c2d72756c652e7376673f6c6162656c3d52656c65617365267374796c653d666f722d7468652d6261646765)](https://packagist.org/packages/elbgoods/laravel-trashmail-rule)[![MIT License](https://camo.githubusercontent.com/a629199185c0134ba12c50289e8384c1945c5451be36067b35810c14304a1505/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f656c62676f6f64732f6c61726176656c2d74726173686d61696c2d72756c652e7376673f6c6162656c3d4c6963656e736526636f6c6f723d626c7565267374796c653d666f722d7468652d6261646765)](https://github.com/elbgoods/laravel-trashmail-rule/blob/master/LICENSE)[![Offset Earth](https://camo.githubusercontent.com/adde0313ccccfe3a49df6bd5075d1391cd7ee9e58c373c83dc9eff84e87ce181/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f54726565776172652d2546302539462538432542332d677265656e3f7374796c653d666f722d7468652d62616467652663616368655365636f6e64733d363030)](https://plant.treeware.earth/elbgoods/laravel-trashmail-rule)

[![GitHub Workflow Status](https://camo.githubusercontent.com/987468db2286780be5ab02fdbe5fa474de656df881835d640555be984f72144c/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f656c62676f6f64732f6c61726176656c2d74726173686d61696c2d72756c652f72756e2d74657374733f6c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/elbgoods/laravel-trashmail-rule/actions?query=workflow%3Arun-tests)[![Total Downloads](https://camo.githubusercontent.com/2a1a79470ebf269c8dbe43d9dc2d594768213df42b00b68ff1d0170d1c953c9e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f656c62676f6f64732f6c61726176656c2d74726173686d61696c2d72756c652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/elbgoods/laravel-trashmail-rule)

This package provides a validation rule to prevent trashmail email addresses.

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

[](#installation)

At first you have to add this package to your `composer.json`:

```
composer require elbgoods/laravel-trashmail-rule
```

After this you can publish the package translation files to adjust the error messages:

```
php artisan vendor:publish --provider="Elbgoods\TrashmailRule\TrashmailRuleServiceProvider" --tag=lang
php artisan vendor:publish --provider="Elbgoods\TrashmailRule\TrashmailRuleServiceProvider" --tag=config
```

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

[](#configuration)

The package provides a configuration to define the rule behaviour.

### Denied domains

[](#denied-domains)

You can add your own list of denied domains, these domains will always be blocked.

### Allowed domains

[](#allowed-domains)

You can add your own list of allowed domains, these domains will always pass.

supported Providers
===================

[](#supported-providers)

- local configuration - `\Elbgoods\TrashmailRule\Providers\ConfigProvider`
-  - `\Elbgoods\TrashmailRule\Providers\DisposableEmailDetectorProvider`
-  - `\Elbgoods\TrashmailRule\Providers\VerifierProvider`

Usage
-----

[](#usage)

Validation Rule
---------------

[](#validation-rule)

This package provides a basic `TrashmailRule` which you can use. All more specific rules only extend this rule with a predefined `format`.

```
use Elbgoods\TrashmailRule\Rules\TrashmailRule;

$rule = new TrashmailRule();
```

By default the rule requires a value - if you want to accept `null` values you can use the `nullable()` method or set the `$required` parameter to `false`.

```
use Elbgoods\TrashmailRule\Rules\TrashmailRule;

$rule = new TrashmailRule(false);
$rule->nullable();
```

Facade
------

[](#facade)

You can also use the facade if you want to check any email address outside validation. This will run the same logic as the validation rule and runs all providers set in the config.

```
use Elbgoods\TrashmailRule\Facades\Trashmail;

Trashmail::isDisposable('example@elbgoods.de');
```

single Provider
---------------

[](#single-provider)

You can also check using a single provider only. Keep in mind that all providers only accept the domain to check and not a full email address. The facade provides a method that returns the domain used in an email address.

```
use Elbgoods\TrashmailRule\Facades\Trashmail;

Trashmail::provider('config')->isDisposable(
    Trashmail::getDomain('example@elbgoods.de')
);
```

custom Provider
---------------

[](#custom-provider)

If you want to add your own provider you can do so.

```
use Elbgoods\TrashmailRule\Facades\Trashmail;
use Illuminate\Contracts\Container\Container;
use Elbgoods\TrashmailRule\Contracts\ProviderContract;

Trashmail::extend('custom_provider', static function (Container $app): ProviderContract {
    return new CustomProvider();
});
```

Changelog
---------

[](#changelog)

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

Versioning
----------

[](#versioning)

This package follows [semantic versioning](https://semver.org/).

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

[](#contributing)

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

### Security

[](#security)

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

Credits
-------

[](#credits)

- [Tom Witkowski](https://github.com/Gummibeer)
- [All Contributors](https://github.com/elbgoods/laravel-trashmail-rule/graphs/contributors)

License
-------

[](#license)

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

Treeware
--------

[](#treeware)

You're free to use this package, but if it makes it to your production environment we would highly appreciate you buying or planting the world a tree.

It’s now common knowledge that one of the best tools to tackle the climate crisis and keep our temperatures from rising above 1.5C is to [plant trees](https://www.bbc.co.uk/news/science-environment-48870920). If you contribute to my forest you’ll be creating employment for local families and restoring wildlife habitats.

You can buy trees at [offset.earth/treeware](https://plant.treeware.earth/elbgoods/laravel-trashmail-rule)

Read more about Treeware at

###  Health Score

35

—

LowBetter than 80% of packages

Maintenance18

Infrequent updates — may be unmaintained

Popularity26

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity68

Established project with proven stability

 Bus Factor1

Top contributor holds 84.2% 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 ~109 days

Recently: every ~245 days

Total

11

Last Release

1182d ago

Major Versions

0.9.0 → 1.02022-03-16

PHP version history (3 changes)0.1.0PHP ^7.4

0.9.0PHP ^7.4 || ^8.0

1.0PHP ^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/eb5d60f7dd33ef3680490f11b3cd461b0c7a5dcddfe69d57fb1f6a3406be4570?d=identicon)[Gummibeer](/maintainers/Gummibeer)

![](https://www.gravatar.com/avatar/33a11c820ca1801a2b0cc065786385f9a1746ae02d1a120102ea7fc7f545eeb7?d=identicon)[Elbgoods](/maintainers/Elbgoods)

---

Top Contributors

[![Gummibeer](https://avatars.githubusercontent.com/u/6187884?v=4)](https://github.com/Gummibeer "Gummibeer (48 commits)")[![mstaack](https://avatars.githubusercontent.com/u/10169509?v=4)](https://github.com/mstaack "mstaack (6 commits)")[![simonbuehler](https://avatars.githubusercontent.com/u/78061?v=4)](https://github.com/simonbuehler "simonbuehler (2 commits)")[![jamesmills](https://avatars.githubusercontent.com/u/557096?v=4)](https://github.com/jamesmills "jamesmills (1 commits)")

---

Tags

blacklistdisposable-checkdisposable-emailemaillaravellaravel-trashmail-rulephpspamtrashmailtreewarevalidationvalidation-ruleswhitelistlaravelvalidationemailtrashmail

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/elbgoods-laravel-trashmail-rule/health.svg)

```
[![Health](https://phpackages.com/badges/elbgoods-laravel-trashmail-rule/health.svg)](https://phpackages.com/packages/elbgoods-laravel-trashmail-rule)
```

###  Alternatives

[propaganistas/laravel-disposable-email

Disposable email validator

5762.6M6](/packages/propaganistas-laravel-disposable-email)[erag/laravel-disposable-email

A Laravel package to detect and block disposable email addresses.

226102.4k](/packages/erag-laravel-disposable-email)[martian/spammailchecker

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

422.0k](/packages/martian-spammailchecker)[osiemsiedem/laravel-autolink

A Laravel package for converting URLs in a given string of text into clickable links.

13126.3k](/packages/osiemsiedem-laravel-autolink)[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)[ashallendesign/laravel-mailboxlayer

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

762.0k](/packages/ashallendesign-laravel-mailboxlayer)

PHPackages © 2026

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