Download the PHP package joshuabedford/laravel-word-filter without Composer
On this page you can find all versions of the php package joshuabedford/laravel-word-filter. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download joshuabedford/laravel-word-filter
More information about joshuabedford/laravel-word-filter
Files in joshuabedford/laravel-word-filter
Package laravel-word-filter
Short Description A word and/or profanity filter for Laravel.
License MIT
Homepage https://github.com/JoshuaBedford/laravel-word-filter
Informations about the package laravel-word-filter
Note: NOT FULLY TESTED
P.S. Yes, I am cringing my way through this one. No, I don't know what most of these words/phrases mean.
Laravel Word Filter
A package that, once installed, allows prohibited words to be filtered out or refused. Works as standalone or with Laravel Validator. Utilizes two database tables to hold a whitelist and blacklist of acceptable and prohibited words. Can be used with Laravel's Form Validation functionality (E.G. prevent certain usernames) to refuse certain inputs and require user correction.
Installation
Configure
The command above will publish the appropriate files. Next, we have to install the database tables.
Now that the database tables are installed, we can seed them with data.
This should seed the database with our list of words that we consider necessary to blacklist or whitelist.
Usage
The $string
will contain the filtered result.
You can also define things inline
You can also use the word
filter with Laravels Validation feature:
Options
-
filter($string = string, $details = boolean)
pass a string to be filtered.- Enable details to have an array of results returned:
reset()
resetreplaceWith
andreplaceFullWords
to defaults.replaceWith(string)
change the chars used to replace filtered strings.replaceFullWords(boolean)
enable to replace full words, disable to replace partial.
Credits
This package is based on LaravelProfanityFilter which is based on banbuilder.