Download the PHP package orionstar/bad-word-filter without Composer

On this page you can find all versions of the php package orionstar/bad-word-filter. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package bad-word-filter

BadWordFilter

A bad word filter for dependency free PHP. Pass in a string or multidimensional array to check for the existence of a predefined list of bad words. Use the list that ships with the application or define your own custom blacklist. BadWordFilter only matches whole words (excluding symbols) and not partial words. This will match:

but this will not:

QuickStart Guide

1) add the following to your composer.json file:

2) Run composer install

3) Add BadWordFilter to your use list

4) start cleaning your inputs~

INPORTANT NOTE
BadWordFilter does not and never will prevent XSS or SQL Injection. Take the proper steps in your code to sanitize all user input before storing to a database or displaying to the client.

Settings options

BadWordFilter takes 3 options:
Source Types
File If you specify a source type of "file" you must also specify a source_file or use the default source file included with this package. The Source File must return an array of words to check for. Array If you specify a source type of "array" you must also specify a "bad_words_array" key that contains a list of words to check for.
Also Check
In addition to the default list specified in the config file or array you can also pass in an "also_check" key that contains an array of words to flag.

Overriding Defaults

You can override the default settings in the constructor if using the class as an instance, or as an optional parameter in the static method call

How to handle bad words

By default bad words will be replaced with the first letter followed by the requisite number of asterisks and then the last letter. Ie: "Cheese" would become "C****e" This can be changed to be replaced with a set string by passing the new string as an argument to the "clean" method or In case you want to keep bad word and surround it by anything (ex. html tag):

Full method list

isDirty
Check if a string or an array contains a bad word Params: $input - required - array|string Return: Boolean Usage:
clean
Clean bad words from a string or an array. By default bad words are replaced with asterisks with the exception of the first and last letter. Optionally you can specify a string to replace the words with Params: $input - required - array|string $replaceWith - optional - string Return: Cleaned array or string Usage:
STATIC clean
Static wrapper around the "clean" method. Params: $input - required - array|string $replaceWith - optional - string $options - optional - array Return: Cleaned array or string Usage:
getDirtyWordsFromString
Return the matched dirty words Params: $input - required - string Return: Boolean Usage:
getDirtyKeysFromArray
After checking an array using the isDirty method you can access the bad keys by using this method Params : none Return: String - dot notation of array keys Usage:

All versions of bad-word-filter with dependencies

PHP Build Version
Package Version
Requires php Version >=7.4
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package orionstar/bad-word-filter contains the following files

Loading the files please wait ....