prometee/sylius-google-recaptcha-v3-plugin

插件,为Sylius的前端表单类型添加Google reCAPTCHA v3字段

安装量: 9,351

依赖: 0

建议者: 0

安全: 0

星标: 7

关注者: 2

分支: 1

公开问题: 0

类型:sylius-plugin


README

Latest Version on Packagist Software License Build Status Quality Score

Sylius 插件,添加Google Recaptcha V3集成

此插件将Google Recaptcha V3添加到以下表单

  • 联系表单
  • 注册表单

但提供了一个抽象类,可以将验证码字段添加到任何其他 Form\Extension

安装

composer require prometee/sylius-google-recaptcha-v3-plugin

配置

启用此插件

<?php

# config/bundles.php

return [
    // ...
    Prometee\SyliusGoogleRecaptchaV3Plugin\PrometeeSyliusGoogleRecaptchaV3Plugin::class => ['all' => true],
    // ...
];

此插件使用 karser/karser-recaptcha3-bundle 来处理Google Recaptcha V3的验证,因此需要进行一些配置。添加或修改 karser/karser-recaptcha3-bundle 的配置

# config/packages/karser_recaptcha3.yaml

karser_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

最后,将您的站点密钥和密钥添加到您的 .env.local 文件

###> google/recaptcha ###
GOOGLE_RECAPTCHA_SITE_KEY=my_site_key
GOOGLE_RECAPTCHA_SECRET=my_secret
###< google/recaptcha ###