{"id":22835259,"url":"https://github.com/gueff/mymvc_module_captcha","last_synced_at":"2025-06-29T11:33:11.695Z","repository":{"id":182299244,"uuid":"667701593","full_name":"gueff/myMVC_module_Captcha","owner":"gueff","description":"Captcha module for myMVC","archived":false,"fork":false,"pushed_at":"2023-07-19T12:19:02.000Z","size":22,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"1.0.x","last_synced_at":"2025-06-04T00:25:44.317Z","etag":null,"topics":["captcha","framework","mymvc","mymvc-module","php","php-framework"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gueff.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-07-18T05:49:39.000Z","updated_at":"2023-07-21T18:15:49.000Z","dependencies_parsed_at":"2023-07-19T13:44:03.787Z","dependency_job_id":null,"html_url":"https://github.com/gueff/myMVC_module_Captcha","commit_stats":null,"previous_names":["gueff/mymvc_module_captcha"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/gueff/myMVC_module_Captcha","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gueff%2FmyMVC_module_Captcha","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gueff%2FmyMVC_module_Captcha/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gueff%2FmyMVC_module_Captcha/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gueff%2FmyMVC_module_Captcha/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gueff","download_url":"https://codeload.github.com/gueff/myMVC_module_Captcha/tar.gz/refs/heads/1.0.x","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gueff%2FmyMVC_module_Captcha/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262586623,"owners_count":23332915,"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","framework","mymvc","mymvc-module","php","php-framework"],"created_at":"2024-12-12T22:08:50.544Z","updated_at":"2025-06-29T11:33:11.656Z","avatar_url":"https://github.com/gueff.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"**this myMVC module provides a captcha image you could use in your own html forms.** \n\n# Requirements\n\n- Linux\n- php \u003e=7.4\n- myMVC\n    - myMVC\n      - 3.2.x: https://github.com/gueff/myMVC/tree/3.2.x\n      - works with 3.3.x too, but requires PHP \u003e=8.0 then\n      - Doku: https://mymvc.ueffing.net/\n- **add a true type font file**\n  - copy your licensed copy of a true type font like \"Andale Mono\" (example: `anadalemo.ttf`)\n    into the root folder of this module\n  - rename that file to `font.ttf`\n\n---\n\n## Install\n\n_cd into the modules folder of your `myMVC3.2.x` copy; e.g.:_  \n~~~bash\ncd /var/www/myMVC/modules/;\n~~~\n\n_clone `myMVC_module_Captcha` as `Captcha`_\n~~~bash\ngit clone --branch 1.0.x https://github.com/gueff/myMVC_module_Captcha.git Captcha;\n~~~\n\n\n## How to use\n\n**1.** _add the following route to your primary working Module_\n\n~~~php\n// captcha route\n\\MVC\\Route::GET(\n    \\Captcha\\Model\\Index::$sRoute,\n    '\\Captcha\\Controller\\Index::index'\n);\n~~~\n\n**2.** _add captcha check and creation in your primary working Module's Controller_\n\n~~~php\n// check if captcha is valid\nif (true === \\Captcha\\Model\\Index::captchaIsValid())\n{\n    // captcha is OK!\n}\n\n// create captcha for new\n$sCaptchaText = \\Captcha\\Model\\Index::createCaptcha();\n~~~\n\n**3.** _add this captcha Formular to your Frontend template_\n\n~~~html\n\u003cform action=\"\" method=\"post\"\u003e\n\n  \u003c!-- captcha --\u003e\n  \u003clabel for=\"captcha\"\u003eCaptcha\u003c/label\u003e\n  \u003cimg src=\"{Captcha\\Model\\Index::$sRoute}\"\u003e\n  \u003cinput type=\"text\"\n         name=\"{Captcha\\Model\\Index::$sPostFieldName}\"\n         maxlength=\"{Captcha\\Model\\Index::$iCaptchaTextLength}\"\n         value=\"\"\n         placeholder=\"captcha code\"\n         autofocus\n  \u003e\n  \u003c!-- /captcha --\u003e\n\n  \u003cbutton type=\"submit\"\u003esubmit\u003c/button\u003e\n\u003c/form\u003e\n~~~\n\n---\n\n🛈 Note: **make sure your Route allows `POST` method**\n\nallow `POST` method in Routes you want to make use of Captcha.\n\n~~~\n\\MVC\\Route::MIX(\n    ['GET', 'POST'],\n    '/',\n    '\\Foo\\Controller\\Index::index',\n    $oDTRoutingAdditional-\u003egetPropertyJson()\n);\n~~~\n\n## Customizing\n\nIn your primary Module's environment config file simply change \nthe properties of the Captcha Model Class.\n\n_Here is an Example_  \n~~~php\n//-------------------------------------------------------------------------------------\n// Module Captcha\n\n// load Class\nrequire_once $aConfig['MVC_MODULES_DIR'] . '/Captcha/Model/Index.php';\n\n// declare a custom route\n\\Captcha\\Model\\Index::$sRoute = '/captcha/MyFormularXY/';\n\n// add some extra chars to choose from...\n\\Captcha\\Model\\Index::$sChar.= '_!=)(/\u0026%$[].:,;+*~#';\n// ...if you changed the $sChar, do not forget to adjust sanitizing rule\n\\Captcha\\Model\\Index::$sCharSanitizePattern = \"/[^\\\\p{L}}\\\\p{M}\\\\p{S}\\\\p{N}\\\\p{P}']+/u\";\n\n// auto-name template input var (name=\"\") like Route\n\\Captcha\\Model\\Index::$sPostFieldName = str_replace('/', '', \\Captcha\\Model\\Index::$sRoute);\n\n// set SessionName like $sPostFieldName\n\\Captcha\\Model\\Index::$sSessionName = \\Captcha\\Model\\Index::$sPostFieldName;\n~~~\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgueff%2Fmymvc_module_captcha","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgueff%2Fmymvc_module_captcha","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgueff%2Fmymvc_module_captcha/lists"}