prugala / recaptcha-bundle
reCAPTCHA v3 bundle for Symfony
Installs: 33 361
Dependents: 0
Suggesters: 0
Security: 0
Stars: 14
Watchers: 1
Forks: 6
Open Issues: 8
Type:symfony-bundle
Requires
- php: ^7.1
- google/recaptcha: ^1.1
- symfony/form: ^2.8 || ^3.0 || ^4.0 || ^5.0
- symfony/framework-bundle: ^2.8 || ^3.0 || ^4.0 || ^5.0
- symfony/validator: ^2.8 || ^3.0 || ^4.0 || ^5.0
- twig/twig: ^2.0 || ^3.0
Requires (Dev)
- phpunit/phpunit: ^7 || ^8
This package is auto-updated.
Last update: 2021-02-11 08:17:41 UTC
README
This repository is archived and not maintained.
Please use: https://github.com/excelwebzone/EWZRecaptchaBundle
RecaptchaBundle
Recaptcha v3 bundle for Symfony
Installation
composer require prugala/recaptcha-bundle
Register bundle in AppKernel.php
file:
new PR\Bundle\RecaptchaBundle\PRRecaptchaBundle()
Configuration
pr_recaptcha: public_key: 'public key' secret_key: 'secret key' enabled: false # optional / default value: true - you can disable it for local or test env score_threshhold: 'score' # optional / default value: 0.5 hide_badge: true # optional / default value: false * host: 'www.google.com' # optional / default value: www.google.com **
*
When you hide badge inform visitors that reCAPTCHA is implemented on website:
https://developers.google.com/recaptcha/docs/faq#hiding-badge
**
If you plan to use reCAPTCHA globally please use host www.recaptcha.net
.
More informations:
https://developers.google.com/recaptcha/docs/faq#can-i-use-recaptcha-globally
In Symfony 4.4 and newer you need to register form theme by yourself by adding in config/packages.twig.yaml
twig: form_themes: ['@PRRecaptcha/Form/recaptcha.html.twig']
How to use
Add field with type RecaptchaType
to your form, example:
->add('captcha', RecaptchaType::class)
Options available:
->add('captcha', RecaptchaType::class, [ 'script_nonce_csp' => $nonce, 'action_name' => 'contact_form' ])
- script_nonce_csp: Nonce for Content-Security-Policy header
- action_name: Form specific action name
TODO
- Support for version v2
- Waiting for suggestions :)