{"id":22374461,"url":"https://github.com/daxslab/no-captcha-php","last_synced_at":"2025-07-21T06:32:57.533Z","repository":{"id":70779496,"uuid":"360733005","full_name":"daxslab/no-captcha-php","owner":"daxslab","description":"No Captcha Form Spam Filter (Mirror from https://code.daxslab.com/daxslab/no-captcha-php)","archived":false,"fork":false,"pushed_at":"2024-06-16T18:43:06.000Z","size":162,"stargazers_count":7,"open_issues_count":1,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-06T15:04:02.327Z","etag":null,"topics":["php","spam-protection"],"latest_commit_sha":null,"homepage":"","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/daxslab.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}},"created_at":"2021-04-23T01:52:42.000Z","updated_at":"2024-03-11T12:57:57.000Z","dependencies_parsed_at":"2023-04-09T04:33:21.597Z","dependency_job_id":null,"html_url":"https://github.com/daxslab/no-captcha-php","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/daxslab/no-captcha-php","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daxslab%2Fno-captcha-php","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daxslab%2Fno-captcha-php/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daxslab%2Fno-captcha-php/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daxslab%2Fno-captcha-php/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/daxslab","download_url":"https://codeload.github.com/daxslab/no-captcha-php/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daxslab%2Fno-captcha-php/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266253614,"owners_count":23900053,"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":["php","spam-protection"],"created_at":"2024-12-04T21:17:10.125Z","updated_at":"2025-07-21T06:32:52.524Z","avatar_url":"https://github.com/daxslab.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# No Captcha Form Spam Filter\n\nNo Captcha Form Spam Filter is a PHP utility library for dealing with \nspam bots using unobtrusive and user friendly techniques.\n\nApplying this techniques will help to reduce the span in your sites in \nmore than 90% and users will not be annoyed with intrusive Captchas or \nextra fields.\n\n## Installation\n\nYou can download it and place it on your third party libraries folder \nbut we highly recommend that you install it through composer.\n\nEither run\n\n`$ composer require daxslab/no-captcha`\n\nor add\n\n`\"daxslab/no-captcha\": \"~1.0\"`\n\nto the `require` section of your `composer.json` file.\n\n## The NoCaptchaAntiSpam Class\n\nThe `NoCaptchaAntiSpam` Class can be used to declare Protection Rules, \nInclude security code in forms and check if the form submission does \nnot trigger any rule validation.\n\nFor creating an instance of the `NoCaptchaAntiSpam` Class, the `create()` \nstatic function can be used: \n    \n```php\nuse daxslab\\nocaptcha\\NoCaptchaAntiSpam;\nuse daxslab\\nocaptcha\\rules\\CssHiddenFieldRule;\n\n// Declare no captcha anti spam object with CSS based hidden field check\n$noCaptchaAntiSpam = NoCaptchaAntiSpam::create([\n        'rules' =\u003e [\n            CssHiddenFieldRule::create([\n                // form input field name\n                'name' =\u003e 'css_hidden_field',\n            ])\n        ],\n]);\n```\n\n## Including form elements\n\nUsing the `NoCaptchaAntiSpam` created instance you can include the needed \nelements inside a form with the `renderRules()` function:\n\n```php\n\u003cform id=\"contactForm\" method=\"post\"\u003e\n    \u003cdiv class=\"form-group\"\u003e\n        \u003clabel for=\"contactName\"\u003eName\u003c/label\u003e\n        \u003cinput class=\"form-control\" name=\"contact_name\" id=\"contactName\" placeholder=\"Enter name\"\u003e\n    \u003c/div\u003e\n    \n    \u003c!--  Include rules form elements  --\u003e\n    \u003c?= $noCaptchaAntiSpam-\u003erenderRules() ?\u003e\n    \n    \u003cbutton type=\"submit\" name=\"submit_button\" class=\"btn btn-primary\"\u003eSubmit\u003c/button\u003e\n\u003c/form\u003e    \n```\n\n## Verifying form submission\n\nUsing the `checkSubmit()` function from the `NoCaptchaAntiSpam` created \ninstance you can check if any of the declared Rules triggers when the \nform is submitted: \n\n```php\nif ($_POST){\n    if ($noCaptchaAntiSpam-\u003echeckSubmit()){\n        echo 'Form submitted correctly';\n    } else {\n        echo 'Bot detected';\n    }\n}\n```\n\n## Rules\n\nRule classes implements different security checks including: \n\n- `CssHiddenFieldRule`: A honeypot field hidden using CSS\n- `JavascriptGeneratedHiddenFieldRule`: A honeypot field generated using JavaScript\n- `JavascriptFilledInputRule`: A JavaScript filled hidden input\n- `SessionTimeTrapRule`: A time trap using session stored variables\n- `FormTimeTrapRule`: A time trap using a form field\n- `CookieCheckRule`: A cookie verification\n\nA `NoCaptchaAntiSpam` instance can contain one or multiple rules.\n\n## Random field names\n\nRandom field names can be applied for an extra security layer, they are \nstored in PHP sessions and rules field names will change making \ndifficult to bots identify them. Random field names can be applied to \nsingle rules or multiple rules. \n\n## Documentation\n\nFor extended documentation and examples you can put the `doc` folder \nbehind a PHP capable web server.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdaxslab%2Fno-captcha-php","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdaxslab%2Fno-captcha-php","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdaxslab%2Fno-captcha-php/lists"}