rapid-data / captcha-bundle
Bundle providing an abstraction layer over Google ReCaptcha v2 and the hCaptcha alternative.
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
Stellt entweder Google ReCaptcha v2 oder die hCaptcha Alternative für Formulare zur Verfügung.
Konfiguration
Für beide Captcha-Anbieter muss bei Verwendung im jeweiligen Account der SiteKey sowie das Secret generiert werden.
Dieses wird dann in der Bundle-Konfiguration hinterlegt, in der contao/config.yml
:
rapid_data_captcha:
sitekey: '612b2149-xxxx-4ff0-xxxx-907ef3050b9b'
secret: '0xxxxxxxxx5a21b154E2b274041ff5aC72aAda591D2'
Tipp: Wenn die Konfiguration nicht vorhanden ist, wird automatisch versucht, CAPTCHA_SITEKEY
und CAPTCHA_SECRET
aus der .env
Datei zu verwenden
Soll Google reCaptcha verwendet werden, muss noch die Service-Konfiguration angepasst werden (der Standard ist hCaptcha):
services:
RapidData\CaptchaBundle\Service\CaptchaInterface:
alias: 'RapidData\CaptchaBundle\Service\ReCaptchaService'
public: true
Soll Friendly Captcha verwendet werden, muss noch die Service-Konfiguration angepasst werden (der Standard ist hCaptcha):
services:
RapidData\CaptchaBundle\Service\CaptchaInterface:
alias: 'RapidData\CaptchaBundle\Service\FriendlyCaptchaService'
public: true