justijndepover/laravel-spam-keyword-validation

Laravel validation rule which checks for frequently used spam words

0.1.0 2022-09-27 16:06 UTC

This package is auto-updated.

Last update: 2024-05-27 19:57:53 UTC


README

Latest Version on Packagist Software License Total Downloads

This package adds a validation rule to Laravel to block requests based on frequently used SPAM words like bitcoin, cryptocurrency, etc... For a full list, check out the config file

Installation

You can install the package with composer

composer require justijndepover/laravel-spam-keyword-validation

After installation you can optionally publish your configuration file

php artisan vendor:publish --tag="laravel-spam-keyword-validation-config"

configuration

This is the config file

<?php

return [
    /**
     * The list of keywords which cannot appear in the request value
     */
    "keywords" => [
        "http://",
        "https://",
        "www",
        "ftp://",
        "mailto:",
        "smb://",
        "afp://",
        "file://",
        "gopher://",
        "news://",
        "ssl://",
        "sslv2://",
        "sslv3://",
        "tls://",
        "tcp://",
        "udp://",
        "url=",
        "href=",
        "dating",
        "sex",
        "porn",
        "fuck",
        "free",
        "win",
        "buy",
        "captcha",
        "spam",
        "hello. and bye.",
        "mail.ru",
        "reading this message",
        "reading my message",
        "reading through my message",
        "are whitelisted",
        "great website",
        "late client",
        "ciao a tutti",
        "viagra",
        "cheap",
        "casino",
        "advertising",
        "keyword",
        "promotion",
        "porntubered",
        "ps: how are you?",
        "beautiful models",
        "privet",
        "beautiful girls",
        "best girls",
        "dosug",
        "trustable",
        "look at the",
        "v7bomdefex",
        "what is it -",
        "email marketing",
        "read your site",
        "crypto",
        "cryptography",
        "cryptocurrency",
        "bitcoin",
        "ethereum",
        "dogecoin",
    ],

];

Usage

Your request can be validated with the blockSpamKeywords validation rule:

$request->validate([
    'message' => ['blockSpamKeywords'],
]);

Security

If you find any security related issues, please open an issue or contact me directly at justijndepover@gmail.com.

Contribution

If you wish to make any changes or improvements to the package, feel free to make a pull request.

License

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