{"id":36976167,"url":"https://github.com/heyitsmi/content-guard","last_synced_at":"2026-01-13T22:09:15.358Z","repository":{"id":331628583,"uuid":"1106501741","full_name":"heyitsmi/content-guard","owner":"heyitsmi","description":"ContentGuard is a robust PHP content sanitization library specifically designed for the Indonesian web ecosystem. It helps developers filter out online gambling spam (judi online), profanity, and hate speech with advanced detection capabilities.","archived":false,"fork":false,"pushed_at":"2026-01-10T12:34:46.000Z","size":20,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-01-11T03:53:01.599Z","etag":null,"topics":["library","package","php"],"latest_commit_sha":null,"homepage":"https://content-guard.diaiti.com","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/heyitsmi.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-11-29T11:32:35.000Z","updated_at":"2026-01-10T12:34:42.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/heyitsmi/content-guard","commit_stats":null,"previous_names":["heyitsmi/content-guard"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/heyitsmi/content-guard","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/heyitsmi%2Fcontent-guard","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/heyitsmi%2Fcontent-guard/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/heyitsmi%2Fcontent-guard/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/heyitsmi%2Fcontent-guard/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/heyitsmi","download_url":"https://codeload.github.com/heyitsmi/content-guard/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/heyitsmi%2Fcontent-guard/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28402192,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-13T14:36:09.778Z","status":"ssl_error","status_checked_at":"2026-01-13T14:35:19.697Z","response_time":56,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["library","package","php"],"created_at":"2026-01-13T22:09:14.648Z","updated_at":"2026-01-13T22:09:15.345Z","avatar_url":"https://github.com/heyitsmi.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# ContentGuard\n\n**ContentGuard** is a robust PHP content sanitization library specifically designed for the **Indonesian** web ecosystem. It helps developers filter out online gambling spam (*judi online*), profanity, and hate speech with advanced detection capabilities.\n\nUnlike simple string replacement tools, ContentGuard uses an intelligent **Regex Engine** to detect \"Leet Speak\" (visual masking) commonly used by spammers (e.g., detecting `s10t g4c0r` as `slot gacor`).\n\n## Features\n\n-   ✅ **Smart Detection:** Catch masked words like `g4c0r`, `s.l.o.t`, `judi`, etc.\n-   ✅ **Pre-built Dictionary:** Comes with a comprehensive database of Indonesian gambling terms and profanity.\n-   ✅ **Laravel Ready:** Includes Service Provider and Facade for seamless integration.\n-   ✅ **Customizable:** Add your own blocklist and configure strictness.\n-   ✅ **Zero Dependencies:** Lightweight and fast.\n\n## Installation\n\nYou can install the package via composer:\n\n```bash\ncomposer require heyitsmi/content-guard\n```\n## Configuration (Laravel)\n\nIf you are using Laravel, you can publish the configuration file to customize the behavior (e.g., changing the mask character or adding custom keywords).\n\nRun the following command:\n```bash\nphp artisan vendor:publish --tag=\"content-guard-config\"\n```\nThis will create a `config/content-guard.php` file in your application.\n\n## Usage\n\n### 1. Using Laravel Facade (Recommended for Laravel)\n\nYou can use the `ContentGuard` facade anywhere in your controllers, jobs, or blade directives.\n```php\nuse Heyitsmi\\ContentGuard\\Facades\\ContentGuard;\n\n// 1. Check if text contains bad words (returns boolean)\n$isSpam = ContentGuard::hasBadWords(\"Ayo main s10t g4c0r hari ini!\"); \n\nif ($isSpam) {\n    return back()-\u003ewithErrors(['message' =\u003e 'Your comment contains restricted content.']);\n}\n\n// 2. Sanitize text (returns clean string)\n$cleanText = ContentGuard::sanitize(\"Jangan main judi online!\");\n// Output: \"Jangan main **** ******!\"\n```\n### 2. Standalone PHP Usage\n\nIf you are not using Laravel, you can instantiate the class directly.\n```php\nuse Heyitsmi\\ContentGuard\\ContentGuard;\n\n$guard = new ContentGuard();\n\n$input = \"Situs g.a.c.o.r terpercaya\";\n\nif ($guard-\u003ehasBadWords($input)) {\n    echo \"Spam detected!\";\n}\n\necho $guard-\u003esanitize($input);\n```\n\n### 3. Client-side Masking (Blur or Hidden)\n\nContentGuard can wrap detected words in HTML tags, allowing you to use CSS and JavaScript for a premium \"click-to-reveal\" experience.\n\n#### Publication (Laravel)\nPublish the assets (CSS and JS):\n```bash\nphp artisan vendor:publish --tag=\"content-guard-assets\"\n```\n\n#### Assets Inclusion\nIn your layout file (e.g., `app.blade.php`), inclusion the assets using the blade directive:\n```html\n\u003chead\u003e\n    ...\n    @contentGuardAssets\n\u003c/head\u003e\n```\n\n#### Usage\nUse the `wrap()` method instead of `sanitize()` to get HTML-tagged content:\n```php\n$text = \"Bocoran slot gacor hari ini\";\n\n// Default is 'blur'\necho ContentGuard::wrap($text); \n\n// Or use 'mask' for a solid black box\necho ContentGuard::wrap($text, 'mask');\n```\n\nThe `wrap()` method will generate:\n`\u003cspan class=\"cg-word cg-blur\" data-cg-word=\"slot\"\u003eslot\u003c/span\u003e`\n\nUsers can click on the blurred/masked word to reveal the original content.\n## How It Works\n\nContentGuard converts standard keywords into flexible Regex patterns based on a Substitution Map.\n\n-   **Input:** `slot`\n    \n-   **Regex Generated:** `/\\b(s|5|\\$|z)[\\W_]*(l|1|!|\\|)[\\W_]*(o|0|@|ø)[\\W_]*(t|7|\\+)\\b/i`\n    \n-   **Matches:** `slot`, `s1ot`, `s.l.o.t`, `s-l-o-t`, `sl0t`, etc.\n    \n\n## Testing\n\nTo run the unit tests included in this package:\n```bash\ncomposer test\n```\n## Contributing\n\nContributions are welcome! If you find new slang words or spam patterns popular in Indonesia, please submit a Pull Request to update the `src/Dictionary` files.\n\n## License\n\nThe MIT License (MIT). Please see License File for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fheyitsmi%2Fcontent-guard","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fheyitsmi%2Fcontent-guard","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fheyitsmi%2Fcontent-guard/lists"}