siezi/cakephp-simple-captcha

Simple Captcha Plugin for CakePHP

Installs: 4 274

Dependents: 3

Suggesters: 0

Security: 0

Stars: 6

Watchers: 1

Forks: 141

Open Issues: 0

Type:cakephp-plugin

pkg:composer/siezi/cakephp-simple-captcha

1.0.0 2020-02-29 07:45 UTC

This package is auto-updated.

Last update: 2025-09-29 01:38:38 UTC


README

Simple captcha plugin for CakePHP. Presents a text field with a simple math problem (plus some invisible checks).

See: https://github.com/Schlaefer/cakephp-simple-captcha

Install

composer require siezi/cakephp-simple-captcha

Include plugin Cake 4 style:

$this->addPlugin(\Siezi\SimpleCaptcha\Plugin::class);

Usage Example

Insert Captcha-Field in Template

Load the helper CakePHP 4 style:

$this->loadHelper('Siezi/SimpleCaptcha.SimpleCaptcha');

In template form:

echo $this->SimpleCaptcha->control();

Validate Captcha in Controller

$validator = new \Siezi\SimpleCaptcha\Model\Validation\SimpleCaptchaValidator();
$errors = $validator->validate($this->request->getData());

Depending on the form you may want to merge the captcha-errors so they are displayed automatically with other form validation errors. For example if the form is backed by a user-entity:

$yourUserEntity->setErrors($errors);