承接 stev/google-recaptcha-bundle 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

stev/google-recaptcha-bundle

最新稳定版本:v1.0.2

Composer 安装命令:

composer require stev/google-recaptcha-bundle

包简介

README 文档

README

Symfony bundle integrating Google Recaptcha

Install

Run composer require stev/google-recaptcha-bundle

Use $builder ->add('recaptcha', GoogleRecaptchaV2Type::class, []); in your forms

In your template add the google script and a parser to inject the captcha response

<script src="https://www.google.com/recaptcha/api.js" async defer></script>

<script type="text/javascript"> function parseCaptchaResponse(recaptchaReponse) { document.getElementById('test_recaptcha').value = recaptchaReponse; } </script>

Add the html snippet where you want the captcha to be rendered. Usually in your form before the submit button.

<div class="g-recaptcha" data-sitekey="{{ google_recaptcha_site_key }}" data-callback="parseCaptchaResponse"></div>

Uncomment the following config in config/packages/google_recaptcha.yaml

twig: globals: google_recaptcha_site_key: '%google_recaptcha_site_key%'

Disable on dev

If you want to bypass the validation in dev env then add this env variable GOOGLE_RECAPTCHA_ENABLED=false

统计信息

  • 总下载量: 6
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: Unknown
  • 更新时间: 2025-01-20