Skip to content
Projekte

Propaganistas/Laravel-Disposable-Email

Auf GitHub ansehen

Über uns

Prüfung temporärer E-Mail-Adressen für Laravel.

Web- und App-Entwicklung

So werden diese Zahlen gemessen

Gemessener Sternzuwachs

in 24h
0
in 7 days
0
in 15 days
0
in 1 month
Verlauf wird gesammelt

Nettoänderungen in überlappenden Zeiträumen, keine Tagessummen. Fehlende Messwerte bleiben leer. Sterne zeigen Interesse, nicht Qualität.

README.md

Original

Laravel Disposable Email

Tests Latest Stable Version Total Downloads License

Adds a validator to Laravel for checking whether a given email address isn't originating from disposable email services such as Mailinator, Guerillamail, ... Uses the disposable domains blacklist from disposable/disposable by default.

Installation

  1. Run the Composer require command to install the package. The service provider is discovered automatically.

    composer require propaganistas/laravel-disposable-email
    
  2. Publish the configuration file and adapt the configuration as desired:

    php artisan vendor:publish --tag=laravel-disposable-email
    
  3. In your languages directory, add an extra translation in every validation.php language file:

    'indisposable' => 'Disposable email addresses are not allowed.',
    
  4. (optional) This package receives a weekly patch release containing updates to the built-in disposable domains list. If you are not able to bump your installed version accordingly, or just want to stay ahead of things, make sure to update the domains list yourself at any interval you like by running or scheduling the disposable:update command:

    // routes/console.php
    
    use Illuminate\Support\Facades\Schedule;
    
    Schedule::command('disposable:update')->daily();
    

Usage

Use the indisposable validator or the Indisposable rule object to ensure a given field doesn't hold a disposable email address. The validator will reject anything that doesn't look like a valid email address, so you should combine it with the email rule:

'field' => ['email', 'indisposable'],
// 'field' => ['email', new Indisposable],

MX record inspection

Disposable services rotate their public "front" domains endlessly (e.g. web-library.net) while their backend mail infrastructure stays constant (e.g. mail.tm). Because a freshly rotated front domain won't be on the list yet, it can slip through a plain domain-list check.

Enabling MX inspection closes that gap: the validator resolves the domain's MX records and flags the address when its mail servers point at a domain that's already on the list.

Simply opt in by specifying the mx parameter:

'field' => ['email', 'indisposable:mx'],
// 'field' => ['email', (new Indisposable)->inspectMxRecords()],

Note: this performs a live DNS lookup during validation, trading a little latency for broader coverage. Leave off the mx parameter if your validation path must stay strictly offline.

Configuration

The published config/disposable-email.php file allows you to customize:

  • sources: URLs returning JSON arrays of domains. disposable:update fetches and combines all sources.
  • storage: the writable path for the updated list. The bundled list is used if this file does not exist.
  • whitelist: exact domains to remove from the disposable list.
  • include_subdomains: also reject email subdomains of listed domains; disabled by default.
  • cache: enable or disable caching and configure the cache store and key. The list is cached indefinitely by default.

The whitelist is applied when loading the list from storage, not to an existing cached list. After changing it, clear the configured domain cache so the list is reloaded.

Custom fetches

By default the package retrieves a new list by using file_get_contents(). If your application has different needs (e.g. when behind a proxy), set disposable-email.fetcher to a class implementing Propaganistas\LaravelDisposableEmail\Contracts\Fetcher. Its handle($url) method must return an array of domains.

Ähnliche Projekte entdecken

Wird geladen…