{"id":15026162,"url":"https://github.com/ph-7/notallowed","last_synced_at":"2025-04-09T20:04:53.824Z","repository":{"id":41579717,"uuid":"197599221","full_name":"pH-7/NotAllowed","owner":"pH-7","description":"🚫 NotAllowed 🚫 =\u003eA lightweight library that helps you to censor words, profane words, banned IPs, banned bank accounts, etc.","archived":false,"fork":false,"pushed_at":"2024-12-01T07:54:02.000Z","size":420,"stargazers_count":7,"open_issues_count":0,"forks_count":4,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-09T20:04:36.908Z","etag":null,"topics":["ban","ban-words","banned","blacklist","censor","censored-words","check-words","filter-words","php72","profane","profane-words","security","spam"],"latest_commit_sha":null,"homepage":"https://packagist.org/packages/ph-7/notallowed","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/pH-7.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},"funding":{"ko_fi":"phenry","github":"pH-7"}},"created_at":"2019-07-18T14:08:42.000Z","updated_at":"2024-12-01T07:54:02.000Z","dependencies_parsed_at":"2024-10-26T22:39:55.370Z","dependency_job_id":"32967525-b68d-48cc-9658-62ce12b41cd4","html_url":"https://github.com/pH-7/NotAllowed","commit_stats":{"total_commits":79,"total_committers":3,"mean_commits":"26.333333333333332","dds":"0.31645569620253167","last_synced_commit":"b03b9298c1c07c2e015cb9ba55fe390f8f9bda30"},"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pH-7%2FNotAllowed","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pH-7%2FNotAllowed/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pH-7%2FNotAllowed/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pH-7%2FNotAllowed/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pH-7","download_url":"https://codeload.github.com/pH-7/NotAllowed/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248103868,"owners_count":21048245,"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":["ban","ban-words","banned","blacklist","censor","censored-words","check-words","filter-words","php72","profane","profane-words","security","spam"],"created_at":"2024-09-24T20:03:54.859Z","updated_at":"2025-04-09T20:04:53.797Z","avatar_url":"https://github.com/pH-7.png","language":"PHP","funding_links":["https://ko-fi.com/phenry","https://github.com/sponsors/pH-7"],"categories":[],"sub_categories":[],"readme":"# 🚫 Not Allowed 🚫\n\n**NotAllowed** is a simple, lightweight PHP 8.1 library that helps you censor words, profane words, blacklisted IPs, forbidden usernames, banned bank card numbers, etc.\n\nYou can easily add new specific keywords (such as IPs, usernames, bank accounts, words, etc.) to be banned in `~/src/banned-data/*` folder.\n\n\n## 🛠 Server Requirement\n\n- [PHP 8.1](https://www.php.net/releases/8.1/en.php) or higher.\n\n\n## 📓 Installation (with Composer)\n\n```bash\ncomposer require ph-7/notallowed\n```\n\n\n## 🎮 Usage\n\nSimple example of what you can do with NotAllowed 🙂\n\n```php\nuse PH7\\NotAllowed\\Ban;\n\nif (Ban::isUsername('admin')) {\n    echo '\"admin\" is not allowed as username.';\n}\n\nif (Ban::isEmail('james@spamhole.com')) {\n    echo '\"@spamhole.com\" domain is considered a spam email host.';\n}\n\nif (Ban::isWord('He is an asshole')) {\n    echo 'Please watch your mouth :-)';\n}\n\nif (Ban::isIp('1.170.36.229')) {\n    echo 'This IP address is blacklisted';\n}\n\n$userInput = 'admin';\nif (Ban::isUsername($userInput, ['root', 'sudo', 'admin'])) {\n    echo \"$userInput is not allowed\";\n}\n\n// Check if $userInput contains a banned word OR a banned username\nif (Ban::isAny($userInput, email: false, word: true, username: true)) {\n    echo \"$userInput is not allowed\";\n}\n```\n\n### Extending Banned Phrases\n\nYou can supply your own values to be merged with the out-of-box banned data in 2 ways:\n\n1. `Ban::merge(string $scope, string | array $value)`\n2. `Ban::mergeFile(string $scope, string $path)`\n\n`$scope` refers to the category of data. Possible values are currently:\n- usernames\n- words\n- ips\n- emails\n- bank_accounts\n\n\u003cdetails\u003e\n\u003csummary\u003eExample\u003c/summary\u003e\n\n```php\nBan::merge('usernames', ['pooter', 'hitler', '690']);\nBan::merge('words', ['cuck', 'bomb']);\nBan::mergeFile('emails', './my_banned_emails.txt');\n```\n\u003c/details\u003e\n\nNow simply validate per normal conventions.\n\n\n## 🚀 Author\n\n**[Pierre-Henry Soria][author-url]**, a highly passionate, zen \u0026amp; cool software engineer 😊\n\n[![@phenrysay][twitter-image]][twitter-url]\n\n[![Pierre-Henry Soria](https://avatars0.githubusercontent.com/u/1325411?s=220)](https://pierrehenry.be \"Pierre-Henry - Software Developer Website :-)\")\n\n### 👩🏻‍💻 Helpers\n\n**[soulshined](https://github.com/soulshined)** - just a coder\n\n\n## 🧐 Used By...\n\n**[pH7Builder][ph7cms-url]**, a social dating webapp builder. Used here: [https://github.com/pH7Software/pH7-Social-Dating-CMS/blob/master/_protected/framework/Security/Ban/Ban.class.php](https://github.com/pH7Software/pH7-Social-Dating-CMS/blob/master/_protected/framework/Security/Ban/Ban.class.php).\n\n\n## ⚖️ License\n\nGenerously distributed under [MIT License][license-url]! 🎈\n\n\n\u003c!-- GitHub's Markdown reference links --\u003e\n[author-url]: https://pierrehenry.be\n[ph7cms-url]: https://ph7cms.com\n[license-url]: https://opensource.org/licenses/MIT\n[twitter-image]: https://img.shields.io/twitter/url/https/shields.io.svg?style=social\n[twitter-url]: https://twitter.com/phenrysay\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fph-7%2Fnotallowed","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fph-7%2Fnotallowed","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fph-7%2Fnotallowed/lists"}