diegomagikal / laravel-tempmail
Validator to block emails from temp mail services
v1.0.2
2018-11-11 19:02 UTC
Requires
- php: ~5.6|~7.0
Requires (Dev)
- phpunit/phpunit: ~4.0||~5.0
This package is auto-updated.
Last update: 2024-10-29 05:22:45 UTC
README
Validator to block temp mails usage.
Introduction
This package verify if the typed email use a domain from any temporary email services and denies it.
Installation
To get the latest version of this package, add the following line to your composer.json:
"diegomagikal/laravel-tempmail": "*"
Usage
Use the rule tempmail
in email validation, like this:
/** * Get a validator. * * @param array $data * @return \Illuminate\Contracts\Validation\Validator */ protected function validator(array $data) { return Validator::make($data, [ 'name' => 'required|string|max:255', 'email' => 'required|email|max:255|unique:users|tempmail', 'password' => 'required|min:6|checkpassword|confirmed', ]); }
Custom message / translation
Add 'tempmail' key to resources/lang/{YOUR_LANG}/validation.php with the desired message.
/* |-------------------------------------------------------------------------- | Custom Validation Language Lines |-------------------------------------------------------------------------- | | Here you may specify custom validation messages for attributes using the | convention "attribute.rule" to name the lines. This makes it quick to | specify a specific custom language line for a given attribute rule. | */ 'tempmail' => 'Este tipo de e-email não é aceito. Digite seu email real!',
Blocked services (growing)
All the domains of the following providers are blocked:
- temp-mail.org
- tempm.com
- getinboxes.com
- getnada.com
License
The MIT License (MIT). Please see License File for more information.