2017 © Pedro Peláez
 

library is_offensive

This PHP package provides an `is_offensive` helper function. Passing a string to `is_offensive` will return a boolean telling you if it contains offensive words.

image

divineomega/is_offensive

This PHP package provides an `is_offensive` helper function. Passing a string to `is_offensive` will return a boolean telling you if it contains offensive words.

  • Tuesday, July 24, 2018
  • by DivineOmega
  • Repository
  • 1 Watchers
  • 1 Stars
  • 84 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 1 Open issues
  • 10 Versions
  • 1 % Grown

The README.md

🤬🤭 Is Offensive Helper Function

Build Status Coverage Status StyleCI, (*1)

This PHP package provides an is_offensive helper function. Passing a string to is_offensive will return a boolean telling you if it contains offensive words., (*2)

Installation

The is_offensive package can be easily installed using Composer. Just run the following command from the root of your project., (*3)

composer require "divineomega/is_offensive"

If you have never used the Composer dependency manager before, head to the Composer website for more information on how to get started., (*4)

Usage

To check if a word is offensive, just pass it to the is_offensive method., (*5)

Here are a few examples:, (*6)

is_offensive('fuck');  // true
is_offensive('fuk');   // true

is_offensive('duck');  // false
is_offensive('cat');   // false

is_offensive('sex');         // true
is_offensive('Middlesex');   // false

is_offensive('tit');         // true
is_offensive('Tittesworth'); // false

is_offensive('cunt');        // true
is_offensive('Scunthorpe');  // false

If you prefer to avoid using helper functions, the following syntax is also available., (*7)

$offensive = (new OffensiveChecker())->isOffensive('fuck')  // true

Custom word lists

There are reasons why you may wish to define your own list of offensive words. Perhaps the ones supplied are too strict, or not strict enough., (*8)

$blacklist = ['moist', 'stinky', 'poo'];

$offensiveChecker = new OffensiveChecker($blacklist);

$offensiveChecker->isOffensive('poo');     // true
$offensiveChecker->isOffensive('poops');   // true

You can also define a whitelist of words that will be accepted even if they match the defined list of offensive words., (*9)

$blacklist = ['moist', 'stinky', 'poo'];
$whitelist = ['poop'];

$offensiveChecker = new OffensiveChecker($blacklist, $whitelist);

$offensiveChecker->isOffensive('poo');     // true
$offensiveChecker->isOffensive('poops');   // false

The Versions

24/07 2018

dev-master

9999999-dev

This PHP package provides an `is_offensive` helper function. Passing a string to `is_offensive` will return a boolean telling you if it contains offensive words.

  Sources   Download

LGPL-3.0-only

The Requires

 

The Development Requires

by Jordan Hall

10/05 2018

v1.4.0

1.4.0.0

This PHP package provides an `is_offensive` helper function. Passing a string to `is_offensive` will return a boolean telling you if it contains offensive words.

  Sources   Download

LGPL-3.0-only

The Requires

 

The Development Requires

by Jordan Hall

07/05 2018

v1.3.2

1.3.2.0

This PHP package provides an `is_offensive` helper function. Passing a string to `is_offensive` will return a boolean telling you if it contains offensive words.

  Sources   Download

LGPL-3.0-only

The Requires

 

The Development Requires

by Jordan Hall

14/03 2018

v1.3.1

1.3.1.0

This PHP package provides an `is_offensive` helper function. Passing a string to `is_offensive` will return a boolean telling you if it contains offensive words.

  Sources   Download

LGPL-3.0-only

The Requires

 

The Development Requires

by Jordan Hall

09/03 2018

v1.3.0

1.3.0.0

This PHP package provides an `is_offensive` helper function. Passing a string to `is_offensive` will return a boolean telling you if it contains offensive words.

  Sources   Download

LGPL-3.0-only

The Requires

 

The Development Requires

by Jordan Hall

15/02 2018

v1.2.0

1.2.0.0

This PHP package provides an `is_offensive` helper function. Passing a string to `is_offensive` will return a boolean telling you if it contains offensive words.

  Sources   Download

LGPL-3.0-only

The Requires

 

The Development Requires

by Jordan Hall

15/02 2018

dev-analysis-z4DpZw

dev-analysis-z4DpZw

This PHP package provides an `is_offensive` helper function. Passing a string to `is_offensive` will return a boolean telling you if it contains offensive words.

  Sources   Download

LGPL-3.0-only

The Requires

 

The Development Requires

by Jordan Hall

14/02 2018

v1.1.0

1.1.0.0

This PHP package provides an `is_offensive` helper function. Passing a string to `is_offensive` will return a boolean telling you if it contains offensive words.

  Sources   Download

LGPL-3.0-only

The Requires

 

The Development Requires

by Jordan Hall

14/02 2018

dev-analysis-8Qm1V6

dev-analysis-8Qm1V6

This PHP package provides an `is_offensive` helper function. Passing a string to `is_offensive` will return a boolean telling you if it contains offensive words.

  Sources   Download

LGPL-3.0-only

The Requires

 

The Development Requires

by Jordan Hall

30/01 2018

v1.0.0

1.0.0.0

This PHP package provides an `is_offensive` helper function. Passing a string to `is_offensive` will return a boolean telling you if it contains offensive words.

  Sources   Download

LGPL-3.0-only

The Requires

 

The Development Requires

by Jordan Hall