{"id":26182734,"url":"https://github.com/jonpurvis/squeaky","last_synced_at":"2026-01-11T07:37:50.859Z","repository":{"id":279514553,"uuid":"938477021","full_name":"JonPurvis/squeaky","owner":"JonPurvis","description":"✨ A Laravel Validation Rule to Help Catch Profanity.","archived":false,"fork":false,"pushed_at":"2025-03-04T22:01:05.000Z","size":81,"stargazers_count":49,"open_issues_count":2,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-14T23:15:48.641Z","etag":null,"topics":["framework","laravel","plugin","profanity","validation"],"latest_commit_sha":null,"homepage":"","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/JonPurvis.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"vendor_name"}},"created_at":"2025-02-25T02:42:27.000Z","updated_at":"2025-04-14T07:02:46.000Z","dependencies_parsed_at":"2025-02-27T01:51:22.617Z","dependency_job_id":"5395dbc4-db20-4997-95f9-9bf874b8bc52","html_url":"https://github.com/JonPurvis/squeaky","commit_stats":null,"previous_names":["jonpurvis/clean","jonpurvis/squeaky"],"tags_count":0,"template":false,"template_full_name":"spatie/package-skeleton-laravel","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JonPurvis%2Fsqueaky","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JonPurvis%2Fsqueaky/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JonPurvis%2Fsqueaky/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JonPurvis%2Fsqueaky/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/JonPurvis","download_url":"https://codeload.github.com/JonPurvis/squeaky/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248975329,"owners_count":21192210,"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":["framework","laravel","plugin","profanity","validation"],"created_at":"2025-03-11T22:24:03.711Z","updated_at":"2026-01-11T07:37:50.853Z","avatar_url":"https://github.com/JonPurvis.png","language":"PHP","readme":"\u003cimg src=\"art/banner.png\"\u003e\n\n# Squeaky\nA Laravel Validation Rule that helps catch profanity in your application.\n\n[![Tests](https://github.com/JonPurvis/squeaky/actions/workflows/tests.yml/badge.svg)](https://github.com/JonPurvis/squeaky/actions/workflows/tests.yml)\n![GitHub last commit](https://img.shields.io/github/last-commit/jonpurvis/squeaky)\n![Packagist PHP Version](https://img.shields.io/packagist/dependency-v/jonpurvis/squeaky/php)\n![GitHub issues](https://img.shields.io/github/issues/jonpurvis/squeaky)\n![GitHub](https://img.shields.io/github/license/jonpurvis/squeaky)\n![Packagist Downloads](https://img.shields.io/packagist/dt/jonpurvis/squeaky)\n\n## Introduction\nSqueaky (short for Squeaky Clean) is a Laravel validation rule that you can add your Laravel application, to ensure any\nuser submitted input such as a name or biography, is free of profanity and therefore, clean. Just add `new Clean()` to\nyour rules and you're good to go!\n\nSqueaky is powered by [Pest Profanity Plugin](https://github.com/pestphp/pest-plugin-profanity), which is a PestPHP Plugin that\ndoes the same thing, but for code. By utilising the profanity in that package, Squeaky is powerful from the get-go and\nprovides support for numerous locales, not just English.\n\n## Installation\n\nTo install Squeaky, you can run the following command in your project's root:\n\n```text\ncomposer require jonpurvis/squeaky\n```\n\nAfter installation, you can publish the configuration file to customize the package behavior:\n\n```bash\nphp artisan vendor:publish --provider=\"JonPurvis\\Squeaky\\SqueakyServiceProvider\"\n```\n\nThis will create a `config/squeaky.php` file in your application where you can configure custom blocked and allowed words.\n\n## Examples\n\nLet's take a look at how Squeaky works. As it's a Laravel Validation rule, there's not really that much to it. You \nwould use it in the same way you would use a custom validation rule you've added yourself.\n\nLet's take the following scenario where we have a form that allows a user to enter their name, email and bio:\n\n```php\nuse App\\Models\\User;\nuse Illuminate\\Validation\\Rule;\nuse JonPurvis\\Squeaky\\Rules\\Clean;\n\nreturn [\n    'name' =\u003e ['required', 'string', 'max:255', new Clean],\n    'email' =\u003e [\n        'required',\n        'string',\n        'lowercase',\n        'email',\n        'max:255',\n        Rule::unique(User::class)-\u003eignore($this-\u003euser()-\u003eid),\n    ],\n    'bio' =\u003e ['required', 'string', 'max:255', new Clean],\n];\n```\n\nYou'll notice that both _name_ and _bio_ are using the **Clean** rule. This rule will take the value and ensure that \nit doesn't exist in the profanity config files that the package has. By default, it will use your app locale, so if \nyour locale is set to `en`, it will scan profanity in the _en_ profanity config.\n\nIf profanity is found, an error will appear in the validation errors array and will be shown to your user \n(if your application does this).\n\nSome applications allow for more than one language, so you're able to pass in additional locales to the rule to cater \nfor them. Below is an example showing how to cater for both `en` and `it`:\n\n```php\nuse JonPurvis\\Squeaky\\Rules\\Clean;\n\n'name' =\u003e ['required', 'string', 'max:255', new Clean(['en', 'it'])],\n```\n\nAlternatively, instead of passing an array of strings to the rule, you can pass in an array of `JonPurvis\\Squeaky\\Enums\\Locale` enums to specify the locales:\n\n```php\nuse JonPurvis\\Squeaky\\Enums\\Locale;\nuse JonPurvis\\Squeaky\\Rules\\Clean;\n\n'name' =\u003e ['required', 'string', 'max:255', new Clean([Locale::English, Locale::Italian])],\n```\n\n\nThis will then check the locale config for any locale you've passed in (providing the config exists!). If profanity is \nfound in any of them, an error will appear in the validation errors. \n\nThe really cool thing about this, is the error will be returned in the language that failed. So if the failure was\nfound in the `it` profanity list, the package assumes the user is Italian and returns the error message in Italian to\nlet them know that their value is not clean.\n\n## Configuration\n\nSqueaky provides a publishable configuration file that allows you to customize the package behavior for your specific application needs.\n\n### Custom Words\n\nYou can specify custom words that should be treated as profanity or explicitly allowed:\n\n```php\n// config/squeaky.php\nreturn [\n    'blocked_words' =\u003e [\n        'company_secret',\n        'internal_term',\n        'restricted_word',\n    ],\n    \n    'allowed_words' =\u003e [\n        'analytics',\n        'scunthorpe',\n        'penistone',\n    ],\n    \n    'case_sensitive' =\u003e false,\n];\n```\n\n- **`blocked_words`**: Words that will be treated as profanity regardless of the locale-specific profanity lists. These override everything else.\n- **`allowed_words`**: Words that will be explicitly allowed even if they appear in the locale-specific profanity lists.\n- **`case_sensitive`**: Determines whether word matching should be case-sensitive. Defaults to `false` for case-insensitive matching.\n\n### Priority Order\n\nThe validation follows this priority order:\n1. Custom blocked words (highest priority - always blocked)\n2. Custom allowed words (override locale profanity)\n3. Locale-specific profanity lists (lowest priority) \n\n## Languages\nSqueaky currently supports the following languages:\n\n- Arabic\n- Danish\n- Danish\n- English\n- German\n- Spanish\n- Italian\n- Japanese\n- Dutch\n- Brazilian Portuguese\n- Russian\n\n## Contributing\nContributions to the package are more than welcome! Depending on the type of change, there's a few extra steps that will\nneed carrying out:\n\n### Existing Locale Changes\nThese changes should be done in [Pest Profanity Plugin](https://github.com/pestphp/pest-plugin-profanit) and a new \nrelease should be tagged. Dependabot will then open a PR on this repo. Once that's been merged, it should be good to \ngo because the config will already be getting loaded.\n\n### New Locale Support\nThe new locale config will need adding to [Pest Profanity Plugin](https://github.com/pestphp/pest-plugin-profanit)\nfirst and a new release should be tagged. Dependabot will then open a PR on this repo. Additionally, the new config \nwill need loading in within the `boot` method of the service provider of this package. \n\nA new case will also need adding to the `JonPurvis/Squeaky/Enums/Locale` enum to support the new locale.\n\n### Functionality Changes\nFor changes to how this rule works, these should be done in this package. No change needed to Pest Profanity Plugin.\n","funding_links":["https://github.com/sponsors/vendor_name"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjonpurvis%2Fsqueaky","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjonpurvis%2Fsqueaky","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjonpurvis%2Fsqueaky/lists"}