{"id":22835257,"url":"https://github.com/gueff/phimcap","last_synced_at":"2026-03-17T15:43:53.840Z","repository":{"id":224095130,"uuid":"637384222","full_name":"gueff/phimcap","owner":"gueff","description":"php captcha image","archived":false,"fork":false,"pushed_at":"2023-05-07T16:54:49.000Z","size":15,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"1.0.x","last_synced_at":"2025-04-24T00:08:28.811Z","etag":null,"topics":["captcha","image-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":"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,"roadmap":null,"authors":null,"dei":null}},"created_at":"2023-05-07T11:53:22.000Z","updated_at":"2023-05-29T14:15:29.000Z","dependencies_parsed_at":"2024-02-23T18:47:37.480Z","dependency_job_id":"908d1060-ff9d-4edb-8634-9cd5866225f6","html_url":"https://github.com/gueff/phimcap","commit_stats":null,"previous_names":["gueff/phimcap"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gueff%2Fphimcap","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gueff%2Fphimcap/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gueff%2Fphimcap/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gueff%2Fphimcap/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gueff","download_url":"https://codeload.github.com/gueff/phimcap/tar.gz/refs/heads/1.0.x","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250535099,"owners_count":21446508,"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","image-captcha","php"],"created_at":"2024-12-12T22:08:50.369Z","updated_at":"2026-03-17T15:43:48.807Z","avatar_url":"https://github.com/gueff.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"**this class provides a captcha image you could use in your own html forms.**\n\n# Requirements\n\n- Linux\n- php \u003e=7.4\n  - GD Library extension\n- existance of a true type font like `FreeMono.ttf`\n\n---\n\n## Install\n\n~~~bash\n{\n  \"require\": {\n    \"gueff/phimcap\":\"1.0.*\"\n  }\n}\n~~~\n\n---\n\n## How to use \n\n### ... a `forgotPassword` - Example using [myMVC 3.2.x](https://mymvc.ueffing.net/)\n\nassuming your primary working Module is called `Foo`:\n\n#### 1) dealing with html form\n\n_create a MIX `/forgotPassword/` route, leading to `\\Foo\\Controller\\Index::forgotPassword`_\n~~~php \n\\MVC\\Route::MIX(\n    ['GET', 'POST'],\n    '/forgotPassword/',\n    '\\Foo\\Controller\\Index::forgotPassword',\n    $oDTRoutingAdditional\n        -\u003eset_sLayout($sTheme . '/Frontend/layout/index.tpl')\n        -\u003eset_sContent($sTheme . '/Frontend/content/forgotPassword.tpl')\n        -\u003egetPropertyJson()\n);\n~~~\n\n_`\\Foo\\Controller\\Index::forgotPassword`: create new captcha text \u0026 save to Session_\n~~~php\npublic function forgotPassword()\n{\n    // grab for POSTed captcha; sanitize\n    $sCaptcha = substr(\n        preg_replace(\"/[^\\\\p{L}\\\\p{N}']+/u\", '', get($_POST['captcha'])),\n        0,\n        strlen(Session::is()-\u003eget('mymvc.captcha'))\n    );\n\n    if (\n        ($sCaptcha === Session::is()-\u003eget('mymvc.captcha'))\n    )\n    {\n        // stuff...\n    }\n\n    // create new captcha text \u0026 save to session\n    $sCaptchaText = \\Phimcap::text();\n    Session::is()-\u003eset('mymvc.captcha', $sCaptchaText);\n\n    $sContent = $this-\u003eoView-\u003eloadTemplateAsString('/Frontend/content/forgotPassword.tpl');\n    $this-\u003eoView-\u003eassign('sContent', $sContent);\n}\n~~~      \n\n_template `/Frontend/content/forgotPassword.tpl`_  \n~~~html\n\u003cform action=\"\" method=\"post\"\u003e\n    \u003clabel for=\"captcha\"\u003eCaptcha\u003c/label\u003e\n    \u003cimg src=\"/captcha/\"\u003e\n    \u003cinput type=\"text\"\n           name=\"captcha\"\n           id=\"captcha\" \n           class=\"form-control\"\n           value=\"\"\n           maxlength=\"5\"\n           placeholder=\"captcha code\"\n    \u003e\n\u003c/form\u003e\n~~~\n\n#### 2) serving the captcha image\n\n_create `\\Foo\\Controller\\Index::captcha`_\n~~~php \npublic function captcha()\n{\n    \\Phimcap::image(\n        Session::is()-\u003eget('mymvc.captcha')\n    );\n}\n~~~\n- here the captcha text for the image is taken from session\n\n_create a `/captcha/` route, leading to `\\Foo\\Controller\\Index::captcha`_\n~~~php\n\\MVC\\Route::GET(\n    '/captcha/',\n    '\\Foo\\Controller\\Index::captcha'\n);\n~~~\n\nSo the captcha image is callable via\n\n~~~html\n\u003cimg src=\"/captcha/\"\u003e\n~~~\n\n---\n\n### Customizing\n\n#### using different Font\n\nPhimcap uses `/usr/share/fonts/truetype/freefont/FreeMono.ttf`, \nwhich is likely to be installed by default on Ubuntu Linux systems.\n\nIf you want a different Font, add the absolute path as second parameter:\n\n~~~php \n\\Phimcap::image(\n    Session::is()-\u003eget('mymvc.captcha'),\n    '/usr/share/fonts/truetype/msttcorefonts/andalemo.ttf'\n);\n~~~\n\n\n#### text length\n\nper default the text length is set to `5`.\n\nyou can change it to a value between `5` up to `10` by adding a value as parameter.\n\n~~~php\n$sCaptchaText = \\Phimcap::text(10);\n~~~","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgueff%2Fphimcap","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgueff%2Fphimcap","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgueff%2Fphimcap/lists"}