2017 © Pedro Peláez
 

library profane

Profanity filtering package for Laravel 4

image

rtablada/profane

Profanity filtering package for Laravel 4

  • Monday, February 17, 2014
  • by rtablada
  • Repository
  • 2 Watchers
  • 15 Stars
  • 540 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 7 Forks
  • 3 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Laravel Profanity Filter

This package facilitates filtering profanity within your Eloquent models and your Laravel project., (*1)

Installation Using Laravel 4 Package Installer

If you have Laravel 4 Package Installer installed you can install Profane by running php artisan package:install rtablada/profane., (*2)

Installing Using Composer

If you do not have Pacakge Installer, you can install Profane by running composer require rtablada/profane and then modifying your providers in app/config/app.php to include 'Rtablada\Profane\FilterServiceProvider' and your aliases to include 'Filter' => 'Rtablada\Profane\Facades\Filter' and replace your existing Eloquent alias with: 'Eloquent' => 'Rtablada\Profane\Model'., (*3)

Using The Filter

The filter is quite simple and can be used at any time using the facade like this:, (*4)

$result = Filter::filter($input);

By default the filter erases all profane words. Alternatively, you can replace profane words using the second argument:, (*5)

$result = Filter::filter($input, '***');

Using Filtered Models

With the standard installation process, all classes that extend the Eloquent Facade will now extend filtered models. This will retain all functionality with the added benifit of allowing you to specify filtered fields with a protected $filtered parameter. You can also define the replacement string used in the filter with a protected $filterReplace. An example model could be:, (*6)

class Post extends Eloquent
{
    protected $filtered = array(
        'title',
        'body',
    );

    protected $filterReplace = '***';
}

The Versions

17/02 2014

dev-master

9999999-dev

Profanity filtering package for Laravel 4

  Sources   Download

MIT

The Requires

 

laravel profanity lpm profane