PHPackages                             marcusyan/profanity - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. marcusyan/profanity

ActiveLibrary

marcusyan/profanity
===================

PHP library to block bad words in a string

3.0.2(5y ago)0543MITPHP

Since May 28Pushed 5y agoCompare

[ Source](https://github.com/Marcusyan/Profanity)[ Packagist](https://packagist.org/packages/marcusyan/profanity)[ RSS](/packages/marcusyan-profanity/feed)WikiDiscussions master Synced 5d ago

READMEChangelog (1)Dependencies (1)Versions (11)Used By (0)

Profanity
=========

[](#profanity)

[![StyleCI Status](https://camo.githubusercontent.com/a539953cd60730d9b3619d8a4b591a1b486cdd367c4a8f3c2c5ae20793b8c6fe/68747470733a2f2f7374796c6563692e696f2f7265706f732f39323636343532332f736869656c643f6272616e63683d6d6173746572267374796c653d666c6174)](https://styleci.io/repos/92664523)[![Build For PHP](https://camo.githubusercontent.com/feb78483745ecc6eff1a0b7fb827846a5948c4db6099779a73b3efe4a83da7b4/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4275696c745f666f722d5048502d626c75652e737667)](https://styleci.io/repos/69124179)[![Total Downloads](https://camo.githubusercontent.com/41f408afcc595fc5097da0cfac209fa15b546c177e58e0a3ad5be23d44e094a9/68747470733a2f2f706f7365722e707567782e6f72672f636f6e736f6c657476732f70726f66616e6974792f642f746f74616c2e737667)](https://packagist.org/packages/consoletvs/profanity)[![Latest Stable Version](https://camo.githubusercontent.com/9ef7e92e7bf313f093b2843503c33d3bfcb948777133098726dd8836105b6c83/68747470733a2f2f706f7365722e707567782e6f72672f636f6e736f6c657476732f70726f66616e6974792f762f737461626c652e737667)](https://packagist.org/packages/consoletvs/profanity)[![License](https://camo.githubusercontent.com/a445cf45da81e95416a0755ca79fec5c30f1b5427b9cff6511947cabd3cb83af/68747470733a2f2f706f7365722e707567782e6f72672f636f6e736f6c657476732f70726f66616e6974792f6c6963656e73652e737667)](https://packagist.org/packages/consoletvs/profanity)

What is Profanity?
------------------

[](#what-is-profanity)

Profanity is a PHP library that allows blocking bad words out of a given string. It currently blocks more than 2.555 words in different languages. It's very easy to use and can filter a 100 chars string in about 0.0021 seconds!

Sample Filter
-------------

[](#sample-filter)

This example is a simple string that is going to be filtered using this library.

```
$clean_words = Profanity::blocker('My cool string bitch')->filter()

// My cool string *****
```

Documentation
-------------

[](#documentation)

### Installation

[](#installation)

First, require it using composer:

```
composer require consoletvs/profanity

```

#### Laravel

[](#laravel)

To install it on laravel, simply add the service provider and the alias in `config/app.php`:

Service Provider:

```
ConsoleTVs\Profanity\ProfanityServiceProvider::class,
```

Alias (optional):

```
'Profanity' => ConsoleTVs\Profanity\Facades\Profanity::class,
```

### Usage

[](#usage)

#### PHP

[](#php)

```
$words = 'My bad word bitch';
$clean_words = \ConsoleTVs\Profanity\Builder::blocker($words)->filter();
// My bad word *****
```

#### Laravel

[](#laravel-1)

```
