captcha() form()

A captcha image with its input; the field is required and checked by the captcha validation rule.

form()->captcha($name = '', $desc = '', $extra = [], $replace = [])

Options

OptionMeaning
$nameDefault captcha.
class, style, placeholder, sizeAttributes of the input.

Example

Code

return form()
    ->email()
    ->captcha();

Notes

  • The image comes from /dynamic/captcha_image; the answer is kept in the session.
  • Validate with the captcha rule: validate(['captcha' => 'captcha']).

See also: form/validate, demo:form/captcha