https://github.com/prometee/syliusgooglerecaptchav3plugin
Add Google Recaptcha v3 to some forms in Sylius to prevent spam
https://github.com/prometee/syliusgooglerecaptchav3plugin
Last synced: 12 days ago
JSON representation
Add Google Recaptcha v3 to some forms in Sylius to prevent spam
- Host: GitHub
- URL: https://github.com/prometee/syliusgooglerecaptchav3plugin
- Owner: Prometee
- Created: 2019-11-20T20:46:17.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2023-11-18T18:00:33.000Z (over 1 year ago)
- Last Synced: 2025-04-12T05:09:56.840Z (23 days ago)
- Language: PHP
- Size: 103 KB
- Stars: 7
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
[![Latest Version on Packagist][ico-version]][link-packagist]
[![Software License][ico-license]](LICENSE)
[![Build Status][ico-github-actions]][link-github-actions]
[![Quality Score][ico-code-quality]][link-code-quality]# Sylius Plugin adding Google Recaptcha V3 integration
This plugin is adding Google Recaptcha V3 to the following forms :
- Contact form
- Registration formBut an abstract class is available to add the captcha field to any other `Form\Extension`
## Installation
```bash
composer require prometee/sylius-google-recaptcha-v3-plugin
```
## ConfigurationEnable this plugin :
```php
['all' => true],
// ...
];
```This plugin is using the `karser/karser-recaptcha3-bundle` to handle the validation of the
Google Recaptcha V3, so a little configuration have to be made.
Add or modify the `karser/karser-recaptcha3-bundle` configuration :```yaml
# config/packages/karser_recaptcha3.yamlkarser_recaptcha3:
host: 'www.recaptcha.net' # in case 'www.google.com' is not accessible (from China for example)
site_key: '%env(GOOGLE_RECAPTCHA_SITE_KEY)%'
secret_key: '%env(GOOGLE_RECAPTCHA_SECRET)%'
score_threshold: 0.5```
Finally add your site key and secret to your `.env.local` file :
```dotenv
###> google/recaptcha ###
GOOGLE_RECAPTCHA_SITE_KEY=my_site_key
GOOGLE_RECAPTCHA_SECRET=my_secret
###< google/recaptcha ###
```[ico-version]: https://img.shields.io/packagist/v/Prometee/sylius-google-recaptcha-v3-plugin.svg?style=flat-square
[ico-license]: https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square
[ico-github-actions]: https://github.com/Prometee/SyliusGoogleRecaptchaV3Plugin/workflows/Build/badge.svg
[ico-code-quality]: https://img.shields.io/scrutinizer/g/Prometee/SyliusGoogleRecaptchaV3Plugin.svg?style=flat-square[link-packagist]: https://packagist.org/packages/prometee/sylius-google-recaptcha-v3-plugin
[link-github-actions]: https://github.com/Prometee/SyliusGoogleRecaptchaV3Plugin/actions?query=workflow%3A"Build"
[link-scrutinizer]: https://scrutinizer-ci.com/g/Prometee/SyliusGoogleRecaptchaV3Plugin/code-structure
[link-code-quality]: https://scrutinizer-ci.com/g/Prometee/SyliusGoogleRecaptchaV3Plugin