Skip to content

Filter Disposable e-mails, to grant that user is using permanent e-mail

Notifications You must be signed in to change notification settings

dann95/l5-disposable-emails-validation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Laravel 5 Disposable E-mails Validation

This repo uses ivolo/disposable-email-domains to update the black list.

How to install?

composer require dann95/l5-disposable-emails-validation

How to use?

Add service provider in config/app.php

    [
        //...
        App\Providers\AppServiceProvider::class,
        App\Providers\AuthServiceProvider::class,
        // App\Providers\BroadcastServiceProvider::class,
        App\Providers\EventServiceProvider::class,
        App\Providers\RouteServiceProvider::class,
        Dann95\L5DisposableEmails\Providers\DisposableEmailsServiceProvider::class /* add it here */
        //...
    ],

Using inside Http/Requests

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'email' => ['required','email','real_email'],
        ];
    }

    /**
     * @return array
     */
    public function messages()
    {
        return [
            'email.real_email' => 'Sorry you are using temporary e-mail',
        ];
    }

Using inside Http/Controller

public function store(Request $request)
{
    $this->validate($request, [
        'email' => 'required|email|real_email',
    ]);
    // the email is valid
}

Using anywhere

    $validator = Validator::make(request()->all(), [
        'email' => 'required|email|real_email',
    ]);

    if ($validator->fails()) {
        // it fails
    }

About

Filter Disposable e-mails, to grant that user is using permanent e-mail

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages