switon/captcha

CAPTCHA generation and verification for Switon Framework

Maintainers

Package info

github.com/switon-php/captcha

Documentation

pkg:composer/switon/captcha

Statistics

Installs: 0

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v1.0.0 2026-05-10 03:52 UTC

This package is auto-updated.

Last update: 2026-05-10 04:10:46 UTC


README

CAPTCHA generation and verification for Switon Framework.

Installation

composer require switon/captcha

Requirements: PHP 8.3+, Redis by default, and either imagick or gd

Quick Start

use Switon\Captcha\CaptchaInterface;
use Switon\Captcha\CaptchaProof;
use Switon\Core\Attribute\Autowired;

class LoginController
{
    #[Autowired] protected CaptchaInterface $captcha;

    public function getCaptcha(): array
    {
        return $this->captcha->create();
    }

    public function verify(string $key, string $code): void
    {
        $this->captcha->verify(CaptchaProof::of($key, $code));
    }
}

Docs: https://docs.switon.dev/latest/captcha

License

MIT.