laravel-spam-email
This package is a Laravel package that checks if an email address is a spammer. It verifies your signups and form submissions to confirm that they are legitimate.
Installation
You can install the package via composer:
composer require martian/spammailchecker
- If you are using Laravel 5.5 or higher, you can use the package directly:
composer require 'martian/spammailchecker'
. - If you're using Laravel 5.4 or lower, you'll need to register the service provider. Open
config/app.php
and add the following line to theproviders
array:
Martian\SpamMailChecker\SpamMailCheckerServiceProvider::class,
Usage
Make use of spammail
in your validation rules:
/**
* Get a validator for an incoming registration request.
*
* @param array $data
* @return \Illuminate\Contracts\Validation\Validator
*/
protected function validator(array $data)
{
return Validator::make($data, [
'email' => 'required|email|spammail|max:255',
]);
}
Or make use of spammail
in your Requests file like this:
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'email' => 'required|email|spammail|max:255',
];
}
Error message shown when the email is a spam:
By default, the error message is:
"email": [ "The email address is a spam address, please try another one." ]
You can customize the error message by opening resources/lang/en/validation.php
and adding to the array like so:
'spammail' => 'You are using a spam email address nerd :-P',
Testing
composer test
Changelog
Please see CHANGELOG for more information what has changed recently.
Contributing
Please feel free to fork this project and make a pull request. For more information check CONTRIBUTING for details.
Security
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
Credits
How to appreciate the work
Here are some ways you can give back to the project:
- Star on GitHub
- Follow me on Twitter @hendurhance
License
The MIT License (MIT). Please see License File for more information.