{"id":27162188,"url":"https://github.com/consoletvs/profanity","last_synced_at":"2025-04-09T00:59:46.556Z","repository":{"id":21404379,"uuid":"92664523","full_name":"ConsoleTVs/Profanity","owner":"ConsoleTVs","description":"PHP library to block bad words in a string","archived":false,"fork":false,"pushed_at":"2024-07-03T21:00:26.000Z","size":169,"stargazers_count":98,"open_issues_count":11,"forks_count":46,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-09-14T14:37:22.952Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ConsoleTVs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-05-28T13:58:46.000Z","updated_at":"2024-08-19T13:26:08.000Z","dependencies_parsed_at":"2024-03-22T10:37:37.545Z","dependency_job_id":"9b935a18-1109-434f-adfe-7d0c21155851","html_url":"https://github.com/ConsoleTVs/Profanity","commit_stats":{"total_commits":33,"total_committers":10,"mean_commits":3.3,"dds":0.7272727272727273,"last_synced_commit":"9e2b46004f4b0318248fdadb1b8576ed65919834"},"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ConsoleTVs%2FProfanity","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ConsoleTVs%2FProfanity/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ConsoleTVs%2FProfanity/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ConsoleTVs%2FProfanity/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ConsoleTVs","download_url":"https://codeload.github.com/ConsoleTVs/Profanity/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247953015,"owners_count":21023947,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-04-09T00:59:46.048Z","updated_at":"2025-04-09T00:59:46.548Z","avatar_url":"https://github.com/ConsoleTVs.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\u003ch1\u003eProfanity\u003c/h1\u003e\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n\u003ca href=\"https://styleci.io/repos/92664523\"\u003e\u003cimg src=\"https://styleci.io/repos/92664523/shield?branch=master\u0026style=flat\" alt=\"StyleCI Status\"\u003e\u003c/a\u003e\n\u003ca href=\"https://styleci.io/repos/69124179\"\u003e\u003cimg src=\"https://img.shields.io/badge/Built_for-PHP-blue.svg\" alt=\"Build For PHP\"\u003e\u003c/a\u003e\n\u003ca href=\"https://packagist.org/packages/consoletvs/profanity\"\u003e\u003cimg src=\"https://poser.pugx.org/consoletvs/profanity/d/total.svg\" alt=\"Total Downloads\"\u003e\u003c/a\u003e\n\u003ca href=\"https://packagist.org/packages/consoletvs/profanity\"\u003e\u003cimg src=\"https://poser.pugx.org/consoletvs/profanity/v/stable.svg\" alt=\"Latest Stable Version\"\u003e\u003c/a\u003e\n\u003ca href=\"https://packagist.org/packages/consoletvs/profanity\"\u003e\u003cimg src=\"https://poser.pugx.org/consoletvs/profanity/license.svg\" alt=\"License\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n## What is Profanity?\n\nProfanity is a PHP library that allows blocking bad words out of a given string. It currently\nblocks more than 2.555 words in different languages. It's very easy to use and can filter a\n100 chars string in about 0.0021 seconds!\n\n## Sample Filter\n\nThis example is a simple string that is going to be filtered using this library.\n\n```php\n$clean_words = Profanity::blocker('My cool string bitch')-\u003efilter()\n\n// My cool string *****\n```\n\n## Documentation\n\n### Installation\n\nFirst, require it using composer:\n\n```\ncomposer require consoletvs/profanity\n```\n\n#### Laravel\n\nTo install it on laravel, simply add the service provider and the alias in ```config/app.php```:\n\nService Provider:\n\n```php\nConsoleTVs\\Profanity\\ProfanityServiceProvider::class,\n```\n\nAlias (optional):\n\n```php\n'Profanity' =\u003e ConsoleTVs\\Profanity\\Facades\\Profanity::class,\n```\n\n### Usage\n\n#### PHP\n\n```php\n$words = 'My bad word bitch';\n$clean_words = \\ConsoleTVs\\Profanity\\Builder::blocker($words)-\u003efilter();\n// My bad word *****\n\n// Filter words only by English and German bad words.\n$clean_words = \\ConsoleTVs\\Profanity\\Builder::blocker($words, languages: ['en', 'de'])-\u003efilter();\n```\n\n#### Laravel\n\n```php\n\u003c?php\n\nnamespace App\\Http\\Controllers;\n\nuse Illuminate\\Http\\Request;\nuse ConsoleTVs\\Profanity\\Facades\\Profanity;\n// or using the alias:\n// use Profanity;\n\nclass HomeController extends Controller\n{\n    /**\n     * Simple test function.\n     *\n     * @return string\n     */\n    public function test()\n    {\n        $words = 'My bad word bitch';\n\n        return Profanity::blocker($words)-\u003efilter();\n        // My bad word *****\n    }\n}\n```\n\n### Methods\n\n#### Constructor\n\n-   blocker($text, $blocker = '****', $languages = [])\n\n    Setup the text and the blocker to use.\n\n    *note:* The blocker defaults to ```****```\n\n    *note:* Pass language codes to reduce the list of bad words that are taken into account.  \n\n#### Class Methods\n\n-   strict(true/false)\n\n    Set the strict mode to enabled or disabled. Strict mode replaces the string even if it's not a word:\n    assets =\u003e (tagged as ass) =\u003e ```****```\n    Disable to ensure normal usage.\n    Defaults to false.\n\n-   strictClean(true/false)\n\n    Set the strict clean mode to enabled or disabled. Strict clean mode ensures the first blocked character is repeated for each bad word character.\n    If so, a bad word of length = 3 (ass) will result in a ```***```, instead of the blocker (defaults to ```****```).\n    If the blocker is ```-**-``` then the same example as above would produce ```---``` as strict clean true and ```-**-``` as false.\n    Defaults to true.\n\n-   clean()\n\n    Returns true if the text have no bad words on it.\n\n-   filter()\n\n    Filters the text with the given blocker.\n\n-   badWords()\n\n    Return the bad words found in the text.\n\n-   text($text)\n\n    Sets the text to filter.\n\n-   blocker($blocker)\n\n    Sets the string that will replace the bad words.\n\n-   dictionary($dictionary)\n\n    Sets the dictionary. If string is provided, it will be treated as a path and will try\n    to decode the json contained in the path. If array is provided, it will set the dictionary.\n\n    Example dictionary:\n    ```json\n    [\n        {\n            \"language\": \"en\",\n            \"word\": \"bitch\"\n        },\n        {\n            \"language\": \"en\",\n            \"word\": \"fuck\"\n        }\n    ]\n    ```\n\n## License\n\n```\nMIT License\n\nCopyright (c) 2017 Erik Campobadal\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fconsoletvs%2Fprofanity","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fconsoletvs%2Fprofanity","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fconsoletvs%2Fprofanity/lists"}