yiirocks / recaptcha
Google reCAPTCHA v2 and v3 field + server-side validator for Yii3.
Package info
pkg:composer/yiirocks/recaptcha
Fund package maintenance!
v1.0.6
2026-08-25 10:05 UTC
Requires
- php: >=8.3
- psr/http-client: ^1.0
- psr/http-factory: ^1.0
- psr/http-message: ^1.0 || ^2.0
- yiisoft/form-model: ^1.1
- yiisoft/html: ^3.13 || ^4.0
- yiisoft/request-provider: ^1.3
- yiisoft/translator: ^3.0
- yiisoft/validator: ^2.5
- yiisoft/widget: ^2.2
Requires (Dev)
- friendsofphp/php-cs-fixer: @stable
- infection/infection: ^0.35.0
- nyholm/psr7: @stable
- phpunit/phpunit: @stable
- psr/container: ^2.0
- rector/rector: ^2.1.1
- vimeo/psalm: ^6.0
- yiisoft/code-style: ^1.1
- yiisoft/translator-message-php: ^1.1
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
Google reCAPTCHA v2 and v3 form field + server-side validator for Yii3.
Stats for Nerds
Features
- reCAPTCHA v2 — checkbox/invisible widget field with theme, size, and type options
- reCAPTCHA v3 — score-based field that fetches its token on form submit (not page load), avoiding surprise challenge popups
- Server-side validation — PHP attribute rules (
RecaptchaV2Rule/RecaptchaV3Rule) verified against Google's siteverify endpoint - Score threshold + action matching — v3 rules can enforce a minimum score and an expected action name
- Zero-config ergonomics — once site keys are set, fields and rules work out of the box via a static registry
- i18n — validation and legal-notice messages are translated through Yii Translator
Requirements
- PHP 8.3+
- PSR-17 request + stream factories
- PSR-18 HTTP client
Installation
composer require yiirocks/recaptcha
Documentation
The complete reference guide is available at Yii.Rocks.