<?php
use Zend\Captcha\Figlet;
use Zend\Debug\Debug;
$captcha = new Figlet(['wordLen' => 3]);
// generates captcha token and stores it in Session
$captcha->generate();
$captchaStr = $captcha->getFiglet()
->render($captcha->getWord());
echo '<pre>' . $captchaStr . '</pre>';
// two possible user inputs.
// id = generated session id
// input = user input
$wrongInput = [
'id' => 1,
'input' => 'asdf',
];
$rightInput = [
'id' => $captcha->getId(),
'input' => $captcha->getWord(),
];
// validate user input
Debug::dump($captcha->isValid($wrongInput));
Debug::dump($captcha->isValid($rightInput));
____ __ __ | _ \\ \ \\/ // ___ | |_| || \ ` // / || | . // | || | [] || |_|\_\\ |_|| \__ || `-` --` `-`' -|_|| `-`
bool(false)
bool(true)