{"id":16758180,"url":"https://github.com/foo123/simple-captcha","last_synced_at":"2025-07-26T09:08:30.949Z","repository":{"id":50563588,"uuid":"519453270","full_name":"foo123/simple-captcha","owner":"foo123","description":"Simple, image-based, mathematical captcha, with increasing levels of difficulty for PHP, JavaScript, Python","archived":false,"fork":false,"pushed_at":"2023-01-22T15:20:06.000Z","size":173,"stargazers_count":8,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-24T14:51:23.656Z","etag":null,"topics":["captcha","javascript","php","python"],"latest_commit_sha":null,"homepage":"","language":"HTML","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/foo123.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":"2022-07-30T07:48:01.000Z","updated_at":"2023-10-22T10:53:45.000Z","dependencies_parsed_at":"2023-02-12T16:46:13.023Z","dependency_job_id":null,"html_url":"https://github.com/foo123/simple-captcha","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/foo123%2Fsimple-captcha","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/foo123%2Fsimple-captcha/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/foo123%2Fsimple-captcha/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/foo123%2Fsimple-captcha/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/foo123","download_url":"https://codeload.github.com/foo123/simple-captcha/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248261869,"owners_count":21074224,"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","javascript","php","python"],"created_at":"2024-10-13T04:04:23.584Z","updated_at":"2025-04-10T17:12:02.921Z","avatar_url":"https://github.com/foo123.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"# simple-captcha\n\nSimple, image-based, mathematical captcha, with increasing levels of difficulty for PHP, JavaScript, Python\n\nversion **2.6.0**\n\n![SimpleCaptcha](/simple-captcha.jpg)\n\n**see also:**\n\n* [ModelView](https://github.com/foo123/modelview.js) a simple, fast, powerful and flexible MVVM framework for JavaScript\n* [tico](https://github.com/foo123/tico) a tiny, super-simple MVC framework for PHP\n* [LoginManager](https://github.com/foo123/LoginManager) a simple, barebones agnostic login manager for PHP, JavaScript, Python\n* [SimpleCaptcha](https://github.com/foo123/simple-captcha) a simple, image-based, mathematical captcha with increasing levels of difficulty for PHP, JavaScript, Python\n* [Dromeo](https://github.com/foo123/Dromeo) a flexible, and powerful agnostic router for PHP, JavaScript, Python\n* [PublishSubscribe](https://github.com/foo123/PublishSubscribe) a simple and flexible publish-subscribe pattern implementation for PHP, JavaScript, Python\n* [Importer](https://github.com/foo123/Importer) simple class \u0026amp; dependency manager and loader for PHP, JavaScript, Python\n* [Contemplate](https://github.com/foo123/Contemplate) a fast and versatile isomorphic template engine for PHP, JavaScript, Python\n* [HtmlWidget](https://github.com/foo123/HtmlWidget) html widgets, made as simple as possible, both client and server, both desktop and mobile, can be used as (template) plugins and/or standalone for PHP, JavaScript, Python (can be used as [plugins for Contemplate](https://github.com/foo123/Contemplate/blob/master/src/js/plugins/plugins.txt))\n* [Paginator](https://github.com/foo123/Paginator)  simple and flexible pagination controls generator for PHP, JavaScript, Python\n* [Formal](https://github.com/foo123/Formal) a simple and versatile (Form) Data validation framework based on Rules for PHP, JavaScript, Python\n* [Dialect](https://github.com/foo123/Dialect) a cross-vendor \u0026amp; cross-platform SQL Query Builder, based on [GrammarTemplate](https://github.com/foo123/GrammarTemplate), for PHP, JavaScript, Python\n* [DialectORM](https://github.com/foo123/DialectORM) an Object-Relational-Mapper (ORM) and Object-Document-Mapper (ODM), based on [Dialect](https://github.com/foo123/Dialect), for PHP, JavaScript, Python\n* [Unicache](https://github.com/foo123/Unicache) a simple and flexible agnostic caching framework, supporting various platforms, for PHP, JavaScript, Python\n* [Xpresion](https://github.com/foo123/Xpresion) a simple and flexible eXpression parser engine (with custom functions and variables support), based on [GrammarTemplate](https://github.com/foo123/GrammarTemplate), for PHP, JavaScript, Python\n* [Regex Analyzer/Composer](https://github.com/foo123/RegexAnalyzer) Regular Expression Analyzer and Composer for PHP, JavaScript, Python\n\n\n**Example:**\n\n1. Captcha with Position Distortion: ![Captcha with Position Distortion](/captcha-position.png)\n2. Captcha with Scale Distortion: ![Captcha with Scale Distortion](/captcha-scale.png)\n3. Captcha with Gradient Background: ![Captcha with Gradient Background](/captcha-gradient.png)\n4. Captcha with custom pattern background: ![Captcha custom pattern background](/captcha-pattern.png)\n\n\n```php\n// setup\n$captcha = (new SimpleCaptcha())\n    -\u003eoption('secret_key', 'SECRET_KEY')\n    -\u003eoption('secret_salt', 'SECRET_SALT_')\n    -\u003eoption('difficulty', 1) // 0 (easy) to 3 (difficult)\n    -\u003eoption('distortion_type', 1) // 1: position distortion, 2: scale distortion\n    -\u003eoption('num_terms', 2)\n    -\u003eoption('max_num_terms', 4) // -1 means constant num_terms\n    -\u003eoption('min_term', 1)\n    -\u003eoption('max_term', 21)\n    -\u003eoption('has_multiplication', true)\n    -\u003eoption('has_division', true)\n    -\u003eoption('has_equal_sign', true)\n    -\u003eoption('color', 0x121212)\n    -\u003eoption('background', 0xffffff)\n;\n```\n\n```html\n\u003c!-- use it --\u003e\n\u003c?php $captcha-\u003ereset(); ?\u003e\n\u003cform action=\"/validate\" method=\"post\"\u003e\n\u003c!-- you can store the captcha hash in the $_SESSION or in $_COOKIE as well --\u003e\n\u003cinput type=\"hidden\" name=\"hash\" value=\"\u003c?php echo $captcha-\u003egetHash(); ?\u003e\" /\u003e\nCompute result \u003cimg src=\"\u003c?php echo $captcha-\u003egetCaptcha(); ?\u003e\" /\u003e \u003cinput type=\"text\" name=\"answer\" value=\"\" /\u003e\n\u003cbutton type=\"submit\"\u003eSubmit\u003c/button\u003e\n\u003c/form\u003e\n```\n\n```php\n// use it\n$app-\u003eon('/validate', function() use ($captcha) {\n    // you can store the captcha hash in the $_SESSION or in $_COOKIE as well\n    if ($captcha-\u003evalidate($_POST['answer'], $_POST['hash']))\n    {\n    // correct captcha\n    }\n    else\n    {\n    // wrong captcha\n    }\n});\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffoo123%2Fsimple-captcha","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffoo123%2Fsimple-captcha","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffoo123%2Fsimple-captcha/lists"}