Giter Club home page Giter Club logo

wtfilter's Introduction

WTFilter

Build Status Total Downloads Latest Stable Version License

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

wtfilter's People

Contributors

itsjw avatar kaankilic avatar xembill avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

itsjw xembill

wtfilter's Issues

Language File not being used?

It looks like when you do the publish, that it puts the files in /resources, not /config (unless I am reading the ReadMe wrong). Either way... when I update the file to remove some words that we did not want to filter on, they are still being filtered on our deployment. Files are in our git repo.

Example word "scum"

Traits - Statically

When I try to store my model, I am getting the error:
Non-static method App\Event::checkProfanity() should not be called statically

Tried making it static, but then it does not have "sources" set.

Trait Not Found

Followed the install directions and the filter call works fine, but when I try to use the trait I am getting:
"Trait 'Kaankilic\WTFilter\Traits\FilterableWords' not found"

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.