Skip to content

🥳🔐 Protect your users from using spam emails to signup/form in your Laravel apps

License

Notifications You must be signed in to change notification settings

vaix-dungpx/laravel-spam-email

 
 

Repository files navigation

laravel-spam-email

Latest Stable Version Total Downloads Latest Unstable Version License PHP Version Require Made in Nigeria

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 the providers 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: api screenshot error

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',

screen shot 2016-07-02 at 2 12 14 pm

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:

License

The MIT License (MIT). Please see License File for more information.

About

🥳🔐 Protect your users from using spam emails to signup/form in your Laravel apps

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • PHP 100.0%