rapid-data / captcha-bundle
提供对 Google ReCaptcha v2 和 hCaptcha 替代方案的抽象层。
1.1.2
2022-11-17 11:35 UTC
Requires
- php: ^7.4 || ^8.0
- contao/core-bundle: ^4.9
- symfony/config: ^4.4 || ^5.1
- symfony/dependency-injection: ^4.4 || ^5.1
- symfony/http-client: ^4.4 || ^5.1
- symfony/http-kernel: ^4.4 || ^5.1
Requires (Dev)
- contao/easy-coding-standard: ^2.0
- contao/manager-plugin: ^2.0
- phpstan/phpstan: ^0.12.65
- phpstan/phpstan-symfony: ^0.12.12
- phpunit/phpunit: ^8.4
- symfony/phpunit-bridge: ^4.4 || ^5.1
Conflicts
- contao/manager-plugin: <2.0 || >=3.0
README
提供 Google ReCaptcha v2 或 hCaptcha 替代方案,用于表单。
配置
对于两个 Captcha 提供商,在相应账户中使用时,必须生成 SiteKey 和 Secret。然后在 Bundle 配置中记录,在 contao/config.yml
文件中。
rapid_data_captcha:
sitekey: '612b2149-xxxx-4ff0-xxxx-907ef3050b9b'
secret: '0xxxxxxxxx5a21b154E2b274041ff5aC72aAda591D2'
提示:如果配置文件不存在,将自动尝试从 .env
文件中获取 CAPTCHA_SITEKEY
和 CAPTCHA_SECRET
。
如果应使用 Google reCaptcha,则需要调整服务配置(默认为 hCaptcha)。
services:
RapidData\CaptchaBundle\Service\CaptchaInterface:
alias: 'RapidData\CaptchaBundle\Service\ReCaptchaService'
public: true
如果应使用 Friendly Captcha,则需要调整服务配置(默认为 hCaptcha)。
services:
RapidData\CaptchaBundle\Service\CaptchaInterface:
alias: 'RapidData\CaptchaBundle\Service\FriendlyCaptchaService'
public: true