{"id":18499756,"url":"https://github.com/s1syphos/uniform-simple-captcha","last_synced_at":"2025-06-14T16:39:40.571Z","repository":{"id":56829213,"uuid":"502137750","full_name":"S1SYPHOS/uniform-simple-captcha","owner":"S1SYPHOS","description":"Simple captcha guard for 'mzur/kirby-uniform' \u0026 Kirby v3","archived":false,"fork":false,"pushed_at":"2022-06-10T18:07:19.000Z","size":1841,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-23T05:05:24.892Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/S1SYPHOS.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-06-10T18:06:56.000Z","updated_at":"2022-06-10T18:07:24.000Z","dependencies_parsed_at":"2022-08-26T13:51:05.135Z","dependency_job_id":null,"html_url":"https://github.com/S1SYPHOS/uniform-simple-captcha","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/S1SYPHOS%2Funiform-simple-captcha","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/S1SYPHOS%2Funiform-simple-captcha/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/S1SYPHOS%2Funiform-simple-captcha/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/S1SYPHOS%2Funiform-simple-captcha/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/S1SYPHOS","download_url":"https://codeload.github.com/S1SYPHOS/uniform-simple-captcha/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254084609,"owners_count":22011908,"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":[],"created_at":"2024-11-06T13:47:13.191Z","updated_at":"2025-05-14T06:30:30.553Z","avatar_url":"https://github.com/S1SYPHOS.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Simple captcha\n\nThis plugin implements a simple captcha guard for Martin Zurowietz' [`kirby-uniform`](https://github.com/mzur/kirby-uniform) plugin for Kirby v3 - dependency-free \u0026 GDPR-friendly, powered by [`php-simple-captcha`](https://codeberg.org/S1SYPHOS/php-simple-captcha), a fork of [`Gregwar/Captcha`](https://github.com/Gregwar/Captcha).\n\n**Note:** The generated image uses a data URI as its `src` attribute, everything else is handled by Kirby's [session object](https://getkirby.com/docs/reference/objects/cms/app/session).\n\n\n## Getting started\n\nUse one of the following methods to install \u0026 use `refbw/uniform-simple-captcha`:\n\n\n### Git submodule\n\nIf you know your way around Git, you can download this plugin as a [submodule](https://github.com/blog/2104-working-with-submodules):\n\n```text\ngit submodule add https://codeberg.org/refbw/uniform-simple-captcha.git site/plugins/uniform-simple-captcha\n```\n\n\n### Composer\n\n```text\ncomposer require s1syphos/refbw/uniform-simple-captcha\n```\n\n\n### Clone or download\n\n1. [Clone](https://codeberg.org/refbw/uniform-simple-captcha.git) or [download](https://codeberg.org/refbw/uniform-simple-captcha/archive/main.zip) this repository.\n2. Unzip / Move the folder to `site/plugins`.\n\n\n## Usage\n\n### Template\n\nThere are two helper functions:\n\n- `simpleCaptcha()` for the captcha `img` tag\n- `simpleCaptchaField()` for its `input` field\n\nYou may use them in your template like so:\n\n```php\n# Captcha image\n# Vanilla\n\u003c?= simpleCaptcha() ?\u003e\n\n# Custom attributes\n\u003c?= simpleCaptcha(['class' =\u003e 'some-class', 'title' =\u003e 'solve me!' ]) ?\u003e\n\n# Input field\n\u003c?= simpleCaptchaField() ?\u003e\n\n# Custom `id` (eg for use with a label)\n\u003clabel for=\"my-captcha\"\u003eNot so fast!\u003c/label\u003e\n\u003c?= simpleCaptchaField('my-captcha', ['class' =\u003e 'some-class']) ?\u003e\n```\n\n\n### Controller\n\nAfter that, you have to enable the guard by calling `simplecaptchaGuard()` on the `$form` object.\n\nFor more information, check out the `kirby-uniform` docs on its [magic methods](https://kirby-uniform.readthedocs.io/en/latest/guards/guards/#magic-methods):\n\n```php\n$form = new Form();\n\nif ($kirby-\u003erequest()-\u003eis('POST')) {\n    # Call security\n    $form-\u003esimplecaptchaGuard();\n\n    # .. more code\n}\n```\n\n\n### Configuration\n\nYou may change certain options from your `config.php` globally (`'simple-captcha.optionName'`):\n\n| Option                 | Type         | Default       | Description                                                |\n| ---------------------- | ------------ | ------------- | ---------------------------------------------------------- |\n| `'length'`             | int          | `5`           | Number of characters                                       |\n| `'charset'`            | string       | a-z, A-Z, 0-9 | Allowed characters (as string)                             |\n| `'width'`              | int          | `150`         | Captcha image `width`                                      |\n| `'height'`             | int          | `40`          | Captcha image `height`                                     |\n| `'fonts'`              | string/array | see `fonts`   | Path(s) to font file(s)                                    |\n| `'distort'`            | bool         | `true`        | Whether to distort the image                               |\n| `'interpolate'`        | bool         | `true`        | Whether to interpolate the image                           |\n| `'maxLinesBehind'`     | int          | random        | Maximum number of lines behind the captcha phrase          |\n| `'maxLinesFront'`      | int          | random        | Maximum number of lines in front of the captcha phrase     |\n| `'maxAngle'`           | int          | `8`           | Maximum character angle                                    |\n| `'maxOffset'`          | int          | `5`           | Maximum character offset                                   |\n| `'bgColor'`            | array/string | random        | Background color, RGB, HEX or `'transparent'`              |\n| `'lineColor'`          | array/string | random        | Line color, RGB or HEX                                     |\n| `'textColor'`          | array/string | random        | Text color, RGB or HEX                                     |\n| `'bgImage'`            | array/string | none          | Path to background image                                   |\n| `'applyEffects'`       | bool         | `true`        | Whether to apply (any) effects                             |\n| `'applyNoise'`         | bool         | `true`        | Whether to apply background noise (using random letters)   |\n| `'noiseFactor'`        | int          | `2`           | Multiples of phrase length to be used for noise generation |\n| `'applyPostEffects'`   | bool         | `true`        | Whether to apply post effects                              |\n| `'applyScatterEffect'` | bool         | `true`        | Whether to enable scatter effect                           |\n| `'randomizeFonts'`     | bool         | `true`        | Whether to use random font for each symbol                 |\n\n**Note:**\n- RGB = array with RGB values, eg `[0, 255, 0]`\n- HEX = hexadecimal notation, eg `'#fafafa'`\n\n\n## License\n\nThis plugin is licensed under the [MIT License](LICENSE), but **using Kirby in production** requires you to [buy a license](https://getkirby.com/buy).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fs1syphos%2Funiform-simple-captcha","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fs1syphos%2Funiform-simple-captcha","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fs1syphos%2Funiform-simple-captcha/lists"}