switon / captcha
CAPTCHA generation and verification for Switon Framework
v1.0.0
2026-05-10 03:52 UTC
Requires
- php: >=8.3
- psr/event-dispatcher: ^1.0
- switon/core: ^1.0
- switon/event: ^1.0
- switon/http: ^1.0
- switon/redis: ^1.0
Requires (Dev)
- switon/testing: ^1.0
Suggests
- ext-gd: Required for GD adapter (fallback)
- ext-imagick: Required for ImageMagick adapter (preferred)
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.