{"id":14966687,"url":"https://github.com/cleantalk/yii2-antispam","last_synced_at":"2025-05-02T22:31:25.311Z","repository":{"id":33142457,"uuid":"36782205","full_name":"CleanTalk/yii2-antispam","owner":"CleanTalk","description":"Anit-spam extension for Yii2 framework.","archived":false,"fork":false,"pushed_at":"2025-03-16T03:02:53.000Z","size":15,"stargazers_count":10,"open_issues_count":1,"forks_count":5,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-04-24T18:05:28.098Z","etag":null,"topics":["anti-spam","antispam","php","spam","spam-prevention","spam-protection","yii","yii2-extension","yii2-framework"],"latest_commit_sha":null,"homepage":null,"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}},"created_at":"2015-06-03T05:33:37.000Z","updated_at":"2024-10-04T11:37:10.000Z","dependencies_parsed_at":"2023-01-14T23:35:29.662Z","dependency_job_id":null,"html_url":"https://github.com/CleanTalk/yii2-antispam","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CleanTalk%2Fyii2-antispam","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CleanTalk%2Fyii2-antispam/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CleanTalk%2Fyii2-antispam/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CleanTalk%2Fyii2-antispam/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CleanTalk","download_url":"https://codeload.github.com/CleanTalk/yii2-antispam/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252116277,"owners_count":21697346,"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":["anti-spam","antispam","php","spam","spam-prevention","spam-protection","yii","yii2-extension","yii2-framework"],"created_at":"2024-09-24T13:36:48.209Z","updated_at":"2025-05-02T22:31:21.085Z","avatar_url":"https://github.com/CleanTalk.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Anti-spam extension by CleanTalk for Yii2 framework.\n\nNo Captcha, no questions, no counting animals, no puzzles, no math.\n\n[![Build Status](https://travis-ci.org/CleanTalk/yii2-antispam.svg)](https://travis-ci.org/cleantalk/yii2-antispam)\n\n\n\n## Requirements\n\n* Yii 2.0 or above\n* CleanTalk account https://cleantalk.org/register?product=anti-spam\n\n##Installation\n\nThe preferred way to install this extension is through [composer](http://getcomposer.org/download/).\n\nEither run\n\n```\nphp composer.phar require --prefer-dist cleantalk/yii2-antispam\n```\n\nor add\n\n```json\n\"cleantalk/yii2-antispam\": \"~1.0.0\"\n```\n\nto the require section of your composer.json.\n\n##Usage\n\n1) Get access key on https://cleantalk.org/register?platform=yii2\n\n2) Open your application configuration in protected/config/web.php and modify components section:\n\n```\n// application components\n'components'=\u003e[\n    ...\n        'antispam' =\u003e [\n            'class' =\u003e 'cleantalk\\antispam\\Component',\n            'apiKey' =\u003e 'Your API KEY',\n        ],\n    ...\n],\n```\n\n3) Add validator in your model, for example ContactForm:\n\n```\nnamespace app\\models;\n\nuse cleantalk\\antispam\\validators\\MessageValidator;\nuse Yii;\nuse yii\\base\\Model;\n\n/**\n * ContactForm is the model behind the contact form.\n */\nclass ContactForm extends Model\n{\n    public $name;\n    public $email;\n    public $body;\n    /**\n     * @inheritdoc\n     */\n    public function rules()\n    {\n        return [\n            // name, email, subject and body are required\n            [['name', 'email', 'subject', 'body'], 'required'],\n            // email has to be a valid email address\n            ['email', 'email'],\n            ['body', MessageValidator::className(), 'emailAttribute'=\u003e'email', /*'nickNameAttribute'=\u003e'name'*/]\n        ];\n    }\n}\n```\n\n4) In form view add widget for hidden Javascript checks:\n\n```\n\u003c?php $form = ActiveForm::begin(); ?\u003e\n    ...\n    \u003c?= \\cleantalk\\antispam\\Widget::widget()?\u003e\n    ...\n    \u003c?= Html::submitButton('Submit')?\u003e\n    ...\n\u003c?php ActiveForm::end(); ?\u003e\n\n```\n\n## User registration validator\n\nSee cleantalk\\antispam\\validators\\UserValidator\n\nExample rules:\n```\n    /**\n     * @inheritdoc\n     */\n    public function rules()\n    {\n        return [\n            [['name', 'email'], 'required'],\n            ['email', 'email'],\n            ['email', UserValidator::className(), 'nickNameAttribute'=\u003e'name']\n        ];\n    }\n```    \n\n##License\nGNU General Public License\n\n##Resources\n\n * https://cleantalk.org/\n * https://github.com/CleanTalk/yii2-antispam\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcleantalk%2Fyii2-antispam","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcleantalk%2Fyii2-antispam","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcleantalk%2Fyii2-antispam/lists"}