grd/ban-words

This package is abandoned and no longer maintained. The author suggests using the abandon package instead.

A simple PHP ban bad words

v1.0.0 2022-05-29 11:00 UTC

This package is auto-updated.

Last update: 2023-06-10 14:33:15 UTC


README

Simple and fast PHP ban bad words you want.

You need to set the bad words in vendor/src/BadWords.php in array of list method.

Inportant note

banWords does not and never will prevent XSS or SQL Injection.

Require

  • PHP >= 7.4
  • composer

Simple usage

composer require grd/ban-words
use App\Grd\BanWords\BanWords;

require_once './vendor/autoload.php';

// 1. Initialize 
$banWords = new BanWords('hello noob you are bad !');

// very simple
var_dump($banWords->check());

// get true if bad words spotted
$banWords->check()->getSignal();        # return true / false

// get normal characters
$banWords->check()->getCharacters();    # return "hello noob you are bad !"

// get ban words
$banWords->check()->getFilter();        # return "hello *** you are *** !"
This script is very simple.
You are welcome to improve it !