{"id":21597382,"url":"https://github.com/cleantalk/php-antispam","last_synced_at":"2025-05-16T06:04:37.218Z","repository":{"id":10374960,"uuid":"12519263","full_name":"CleanTalk/php-antispam","owner":"CleanTalk","description":"A PHP API for antispam service cleantalk.org. Invisible protection from spam, no captches, no puzzles, no animals and no math.","archived":false,"fork":false,"pushed_at":"2025-05-13T07:09:35.000Z","size":289,"stargazers_count":62,"open_issues_count":1,"forks_count":31,"subscribers_count":17,"default_branch":"master","last_synced_at":"2025-05-16T06:04:20.323Z","etag":null,"topics":["antispam","php","php-api","spam","spam-protection"],"latest_commit_sha":null,"homepage":"http://cleantalk.org","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/CleanTalk.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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}},"created_at":"2013-09-01T10:54:39.000Z","updated_at":"2025-04-23T18:20:29.000Z","dependencies_parsed_at":"2023-11-25T23:27:34.827Z","dependency_job_id":"c669b38c-e2dd-4d67-8009-7a160cfbd484","html_url":"https://github.com/CleanTalk/php-antispam","commit_stats":{"total_commits":158,"total_committers":20,"mean_commits":7.9,"dds":0.7151898734177216,"last_synced_commit":"9fc8abc464dd405a2e7dde8fb1f456a6b1ed39ca"},"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CleanTalk%2Fphp-antispam","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CleanTalk%2Fphp-antispam/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CleanTalk%2Fphp-antispam/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CleanTalk%2Fphp-antispam/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CleanTalk","download_url":"https://codeload.github.com/CleanTalk/php-antispam/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254478186,"owners_count":22077675,"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":["antispam","php","php-api","spam","spam-protection"],"created_at":"2024-11-24T18:08:53.158Z","updated_at":"2025-05-16T06:04:37.191Z","avatar_url":"https://github.com/CleanTalk.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"php-antispam\n============\n![example workflow](https://github.com/CleanTalk/php-antispam/actions/workflows/tests.yml/badge.svg)\n\n[![Latest Stable Version](https://poser.pugx.org/cleantalk/php-antispam/v)](https://packagist.org/packages/cleantalk/php-antispam)\n\nA PHP API for antispam service cleantalk.org. Invisible protection from spam, no captches, no puzzles, no animals and no math.\n\n## How API stops spam?\nAPI uses several simple tests to stop spammers.\n  * Spam bots signatures.\n  * Blacklists checks by Email, IP, web-sites domain names.\n  * JavaScript availability.\n  * Relevance test for the comment.\n\n## How API works?\nAPI sends a comment's text and several previous approved comments to the servers. Servers evaluates the relevance of the comment's text on the topic, tests on spam and finaly provides a solution - to publish or put on manual moderation of comments. If a comment is placed on manual moderation, the plugin adds to the text of a comment explaining the reason for the ban server publishing.\n\n## Requirements\n\n   * PHP 5.6 and above \n   * CURL support \n\nYou can unpack the archive with the plugin to the root of the site or install it using the composer\n\n```php\ncomposer require cleantalk/php-antispam\n```\n   \n### Sample SPAM test for text comment\n\nNotice: You can use the example PHP file from \u003ccode\u003e./examples/form_with_handler\u003c/code\u003e\n\n```php\n\u003c?php\nsession_start();\n\n$apikey = '';\n$email_field = 'name_email_form_field';\n$user_name_field = 'name_user_name_form_field';\n$message_field = 'name_message_form_field';\n$type_form = 'contact'; // use 'signup' for user signup form\n\n// if downloaded, unzip and include the app, take your own relative path:\nrequire_once 'php-antispam/cleantalk-antispam.php';\n// if install the app by composer package:\nuse Cleantalk\\CleantalkAntispam;\n\n//require_once \"lib/cleantalk-php-patch.php\"; -- PHP-FPM\n\n$cleantalk_antispam = new CleantalkAntispam($apikey, $email_field, $user_name_field, $message_field, $type_form);\n$api_result = $cleantalk_antispam-\u003ehandle();\nif ($api_result) { // the check fired\n    if ($api_result-\u003eaccount_status !== 1) {\n        // something wrong with your key or license, to know why read $api_result-\u003ecodes\n        echo 'Allowed. Spam protection disabled.'; // or do nothing\n    } else {\n        if ($api_result-\u003eallow === 1) {\n            echo 'Allowed. Spam protection OK.'; // or do nothing\n        } else {\n            die('Blocked. Spam protection OK. Reason: ' . $api_result-\u003ecomment); // or make your own handler\n        }\n    }\n}\n// your further code flow here\n?\u003e\n\n\u003cform method=\"post\"\u003e\n    \u003clabel for=\"login\"\u003eLogin:\u003c/label\u003e\n    \u003cinput type=\"text\" name=\"name_user_name_form_field\" id=\"login\" /\u003e\n    \u003cbr /\u003e\n    \u003clabel for=\"email\"\u003eEmail:\u003c/label\u003e\n    \u003cinput type=\"text\" name=\"name_email_form_field\" id=\"email\" value=\"\" /\u003e\n    \u003cbr /\u003e\n    \u003clabel for=\"message\"\u003eMessage:\u003c/label\u003e\n    \u003ctextarea name=\"name_message_form_field\" id=\"message\"\u003e\u003c/textarea\u003e\n    \u003cbr /\u003e\n    \u003cinput type=\"submit\" /\u003e\n\u003c/form\u003e\n\n\u003c?php $cleantalk_antispam-\u003efrontendScript(); ?\u003e\n```\n\n## API Response description\nAPI returns (`$api_result`) PHP object:\n  * allow (0|1) - allow to publish or not, in other words spam or ham\n  * comment (string) - server comment for requests.\n  * id (string MD5 HEX hash) - unique request idenifier.\n  * errno (int) - error number. errno == 0 if requests successfull.\n  * errstr (string) - comment for error issue, errstr == null if requests successfull.\n  * account_status - 0 account disabled, 1 account enabled, -1 unknown status.\n  \n## Don't want to deal with all this?\nUniversal solution for any CMS or custom website: https://github.com/CleanTalk/php-uni  \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcleantalk%2Fphp-antispam","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcleantalk%2Fphp-antispam","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcleantalk%2Fphp-antispam/lists"}