dann95 / l5-disposable-emails-validation
Validation of disposable e-mails for Laravel 5
Installs: 25
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 1
Forks: 1
Open Issues: 0
Type:package
Requires
- illuminate/support: 5.0.*|5.1.*|5.2.*|5.3.*|5.4.*|5.5.*
This package is auto-updated.
Last update: 2024-10-20 04:10:22 UTC
README
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 }