Yii 1.1: google-profanity

filter bad words using Google API

Filter bad words using Google Profanity API


Yii 1.1 or above


put the zip file into your extension folder

and in your models

public function rules(){
        return array(
                'replaceNumbers'=>true, // replace special characters to letters
                'trimLeft'=>true, // trim left character. e.g. 3fuck = fuck
                'trimRight'=>true, // trim right character. e.g fuck3 = fuck
                //'trim'=>'true', // default to false. delete left and right character. e.g 3fuck3 = fuck
                //'trimCharList'=>'0123456789', // char list for trimming, default to 0-9

Example Profanity

  1. suck1 = suck (if trimRight is true, remove character on right with "trimCharList")

  2. 1suck = suck (if trimLeft is true, remove character on left with "trimCharList")

  3. s3x = sex (if replaceNumbers = true, will replace to s3x = sex)


Total 2 comments

#15077 report it
bryglen at 2013/10/05 03:39am

thanks for the changes. well the main purpose here is to check profanity on the "username" and not a sentence.

#14141 report it
Cozumel at 2013/07/22 06:36pm
Minor Fix

Thanks for this extension! At the moment this will only validate one word at a time and fail on sentences, pretty useless for an actual application.

In GoogleProfanityValidator.php

Change line 56 from




Leave a comment

Please to leave your comment.

Create extension