kaankilic / wtfilter
What The Filter is Profinaity Filter for Laravel
Installs: 3 262
Dependents: 0
Suggesters: 0
Security: 0
Stars: 5
Watchers: 1
Forks: 1
Open Issues: 3
pkg:composer/kaankilic/wtfilter
Requires
- php: >=5.5.9
Requires (Dev)
- mockery/mockery: ^0.9.4
- orchestra/testbench: ^3.0
- phpunit/phpunit: ^4.8 || ^5.0
README
Introduction
WTFilter provides an expressive and fluent way to filter profanities from the content with using it's own engine. WTFilter is the simplest stable profanity filter for Laravel.
License
Laravel WTFilter is open-sourced software licensed under the MIT
Official Documentation
It's simplest way of filtering profanities with the capabilities of Language form. You can set multilangual profanities on each language that you are using on your Laravel project.
Installation
To get started with WTFilter, use Composer to add the package to your project's dependencies:
composer require kaankilic/wtfilter
After installing the WTFilter library, register the Kaankilic\WTFilter\Providers\WTFilterServiceProvider in your config/app.php configuration file:
Kaankilic\WTFilter\Providers\WTFilterServiceProvider::class,
Also, add the WTFilter facade to the aliases array in your app configuration file:
'WTFilter' => Kaankilic\WTFilter\Facades\WTFilter::class
Lastly, Publish the config and language files.
php artisan vendor:publish --provider="Kaankilic\WTFilter\Providers\WTFilterServiceProvider"
This command will generate the configrations on your /config folder, and generate the default language folder on your project.
Basic Usage
<?php namespace App\Http\Controllers; use WTFilter; class CommentsController extends Controller { /** * It's filtering your comments that contains profanities. */ public function createComment(Request $request){ $contentOfComments = WTFilter::filter($request->get("content_of_comment")); } }
Model Trait Usage
You can simply use FilterableTrait on your Model to filter profanities.
<?php ... use Kaankilic\WTFilter\Traits\FilterableWords; class CustomModel extends Model{ use FilterableWords; public function filterable(){ return [ "sources" => ["title"], // trait gonna check this columns "flag" => "has_profanity" // *optionally you can set flag to any column ]; } ...
Contributions
I am the creator and single contributor of the project. So, Feel free to contribute something useful. Please use Github for reporting bugs, and making comments or suggestions
