{"id":18709092,"url":"https://github.com/jojoee/leo-profanity-php","last_synced_at":"2025-04-12T10:35:03.885Z","repository":{"id":57001054,"uuid":"84089743","full_name":"jojoee/leo-profanity-php","owner":"jojoee","description":":tiger: Profanity filter, based on \"Shutterstock\" dictionary","archived":false,"fork":false,"pushed_at":"2017-04-12T08:47:22.000Z","size":27,"stargazers_count":5,"open_issues_count":1,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-26T05:51:10.020Z","etag":null,"topics":["bad","curse","dirty","obscene","profanity","swear"],"latest_commit_sha":null,"homepage":"https://packagist.org/packages/jojoee/leo-profanity","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/jojoee.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-03-06T15:32:38.000Z","updated_at":"2024-10-25T12:10:28.000Z","dependencies_parsed_at":"2022-08-21T11:40:44.245Z","dependency_job_id":null,"html_url":"https://github.com/jojoee/leo-profanity-php","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jojoee%2Fleo-profanity-php","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jojoee%2Fleo-profanity-php/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jojoee%2Fleo-profanity-php/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jojoee%2Fleo-profanity-php/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jojoee","download_url":"https://codeload.github.com/jojoee/leo-profanity-php/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248442608,"owners_count":21104222,"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":["bad","curse","dirty","obscene","profanity","swear"],"created_at":"2024-11-07T12:26:16.025Z","updated_at":"2025-04-12T10:35:03.612Z","avatar_url":"https://github.com/jojoee.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# leo-profanity-php\n\n[![Latest Version on Packagist][ico-version]][link-packagist]\n[![Software License][ico-license]](LICENSE.md)\n[![Build Status][ico-travis]][link-travis]\n\nProfanity filter, based on Shutterstock dictionary\n\n## Install\n\nVia Composer\n\n``` bash\n$ composer require jojoee/leo-profanity\n```\n\n``` php\nuse Jojoee\\Library\\LeoProfanity as LeoProfanity;\n\n$filter = new LeoProfanity();\n$filter-\u003echeck('I have BoOb');\n```\n\n## Usage\n\n### $filter-\u003egetList()\n\n``` php\n// return all profanity words (string[])\n$filter-\u003egetList();\n```\n\n### $filter-\u003echeck(string)\n\nCheck out mor example on `clean` method\n\n``` php\n// output: true\n$filter-\u003eclean('I have boob');\n```\n\n### $filter-\u003eclean(string, [replaceKey=*])\n\n``` php\n// no bad word\n// output: I have 2 eyes\n$filter-\u003eclean('I have 2 eyes');\n\n// normal case\n// output: I have ****, etc.\n$filter-\u003eclean('I have boob, etc.');\n\n// case sensitive\n// output: I have ****\n$filter-\u003eclean('I have BoOb');\n\n// separated by comma and dot\n// output: I have ****.\n$filter-\u003eclean('I have BoOb.');\n\n// multi occurrence\n// output: I have ****,****, ***, and etc.\n$filter-\u003eclean('I have boob,boob, ass, and etc.');\n\n// should not detect unspaced-word\n// output: Buy classic watches online\n$filter-\u003eclean('Buy classic watches online');\n\n// clean with custom replacement-character\n// output: I have ++++\n$filter-\u003eclean('I have boob', '+');\n```\n\n### $filter-\u003eadd(string|string[])\n\n``` php\n// add word\n$filter-\u003eadd('b00b');\n\n// add word's array\n// check duplication automatically\n$filter-\u003eadd(['b00b', 'b@@b']);\n```\n\n### $filter-\u003eremove(string|string[])\n\n``` php\n// remove word\n$filter-\u003eremove('b00b');\n\n// remove word's array\n$filter-\u003eremove(['b00b', 'b@@b']);\n```\n\n### $filter-\u003ereset()\n\nReset word list by using default dictionary (also remove word that manually add)\n\n### $filter-\u003eclearList()\n\nClear all profanity words\n\n## Note\n\n- [Filter algorithm from `jojoee/leo-profanity`](https://github.com/jojoee/leo-profanity#algorithm)\n- Testing (using `composer test`) \n- [PSR-2 Coding Standard](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md) (tested by `composer check-style` and fix it with `composer fix-style`.)\n- Security, if you discover any security related issues, please email inid3a@gmail.com instead of using the issue tracker.\n- Follow [SemVer v2.0.0](http://semver.org/)\n- Coherent history (each individual commit is meaningful), if not please [squash them](http://www.git-scm.com/book/en/v2/Git-Tools-Rewriting-History#Changing-Multiple-Commit-Messages).\n\n## TODO\n\n- [x] Unit test\n- [x] Test coverage\n- [x] PHP CodeSniffer\n- [x] Support PHP version 5.6, 7.0, hhvm\n\n## Other languages\n- [x] Javascript on [npmjs.com/package/leo-profanity](https://www.npmjs.com/package/leo-profanity)\n- [x] PHP on [packagist.org/packages/jojoee/leo-profanity](https://packagist.org/packages/jojoee/leo-profanity)\n- [ ] Python on [PyPI](https://pypi.python.org/pypi)\n- [ ] Java on [Maven](https://maven.apache.org/)\n- [ ] Wordpress on [wordpress.org](https://wordpress.org/)\n\n## Contribute\n\nPlease run `composer check` and fix before commit\n\n## Reference\n\n- Skeleton template: [thephpleague/skeleton](https://github.com/thephpleague/skeleton), [koriym/Koriym.PhpSkeleton](https://github.com/koriym/Koriym.PhpSkeleton), [petk/php-skeleton](https://github.com/petk/php-skeleton)\n\n[ico-version]: https://img.shields.io/packagist/v/jojoee/leo-profanity.svg?style=flat-square\n[ico-license]: https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square\n[ico-travis]: https://img.shields.io/travis/jojoee/leo-profanity-php/master.svg?style=flat-square\n\n[link-packagist]: https://packagist.org/packages/jojoee/leo-profanity\n[link-travis]: https://travis-ci.org/jojoee/leo-profanity-php\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjojoee%2Fleo-profanity-php","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjojoee%2Fleo-profanity-php","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjojoee%2Fleo-profanity-php/lists"}