Skip to content
프로젝트

Propaganistas/Laravel-Disposable-Email

GitHub에서 보기

소개

Laravel용 일회용 이메일 주소 검증기입니다.

웹 및 앱 개발

이 수치를 측정하는 방법

측정된 스타 증가

in 24h
0
in 7 days
0
in 15 days
0
in 1 month
기록 수집 중

서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.

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.

관련 프로젝트 살펴보기

불러오는 중…