Skip to content

switon-php/captcha

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Switon Captcha Package

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.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages