{"id":16924469,"url":"https://github.com/theodorejb/responsive-captcha","last_synced_at":"2025-04-11T11:31:03.442Z","repository":{"id":6083526,"uuid":"7310139","full_name":"theodorejb/Responsive-Captcha","owner":"theodorejb","description":"A PHP library for generating random, accessible arithmetic and logic questions","archived":false,"fork":false,"pushed_at":"2020-12-11T18:52:50.000Z","size":42,"stargazers_count":12,"open_issues_count":0,"forks_count":6,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-03-25T13:11:21.249Z","etag":null,"topics":["captcha","php"],"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/theodorejb.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-12-24T17:55:20.000Z","updated_at":"2023-12-19T05:24:53.000Z","dependencies_parsed_at":"2022-09-05T21:51:28.793Z","dependency_job_id":null,"html_url":"https://github.com/theodorejb/Responsive-Captcha","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/theodorejb%2FResponsive-Captcha","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/theodorejb%2FResponsive-Captcha/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/theodorejb%2FResponsive-Captcha/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/theodorejb%2FResponsive-Captcha/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/theodorejb","download_url":"https://codeload.github.com/theodorejb/Responsive-Captcha/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248383896,"owners_count":21094627,"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":["captcha","php"],"created_at":"2024-10-13T20:05:16.140Z","updated_at":"2025-04-11T11:31:03.202Z","avatar_url":"https://github.com/theodorejb.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Responsive Captcha\n\n[![Packagist Version](https://img.shields.io/packagist/v/theodorejb/responsive-captcha.svg)](https://packagist.org/packages/theodorejb/responsive-captcha)\n\nPrevent form spam by generating random, accessible arithmetic and logic questions.\n\nExamples:\n\n* \"What is the fourth letter in snowboard?\"\n* \"What is the sum of four and six?\"\n* \"What is eight multiplied by two?\"\n* \"Which is smallest: sixty-six, one hundred, or twenty-two?\"\n\nUsers can respond with either the numeric or textual version of an answer (e.g. \"16\" or \"sixteen\").\n\nFor background info on this project, see my blog post: https://theodorejb.me/2012/12/30/responsive-captcha/\n\n## Install via Composer\n\n`composer require theodorejb/responsive-captcha`\n\n## Usage\n\n1. Generate a random question:\n\n    ```php\n    use function theodorejb\\ResponsiveCaptcha\\{randomQuestion, checkAnswer};\n\n    $qa = randomQuestion();\n    $realAnswer = $qa-\u003egetAnswer(); // save somewhere (e.g. in session or encrypted single-use token)\n    ```\n\n2. Display question in form:\n\n    ```html+php\n    \u003clabel\u003e\n\t    \u003c?= $qa-\u003egetQuestion() ?\u003e\n        \u003cinput type=\"text\" name=\"captcha\" /\u003e\n\t\u003c/label\u003e\n\t```\n\n3. Check whether the user's response is correct:\n\n    ```php\n    $answer = filter_input(INPUT_POST, \"captcha\");\n\n    if ($answer !== null) {\n        if (checkAnswer($answer, $realAnswer)) {\n            // code to execute if the captcha answer is correct\n        } else {\n            // the answer is incorrect - show an error to the user\n        }\n    }\n    ```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftheodorejb%2Fresponsive-captcha","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftheodorejb%2Fresponsive-captcha","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftheodorejb%2Fresponsive-captcha/lists"}