backend2-plus/google-captcha-bundle 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

backend2-plus/google-captcha-bundle

最新稳定版本:v1.3.1

Composer 安装命令:

composer require backend2-plus/google-captcha-bundle

包简介

Google reCAPTCHA bundle for Symfony

README 文档

README

Simple Symfony bundle for Google reCAPTCHA integration.

Installation

composer require sasa1007/google-captcha-bundle

Note: After installation, you need to manually configure the bundle as described below.

Configuration

Create configuration file config/packages/google_captcha.yaml:

google_captcha:
    secret: '%env(GOOGLE_CAPTCHA_SECRET)%'

Add to your .env file:

GOOGLE_CAPTCHA_SECRET=your_google_recaptcha_secret_key

Note: Replace your_google_recaptcha_secret_key with your actual Google reCAPTCHA secret key from Google reCAPTCHA Admin Console.

Usage

use BeckUp\GoogleCaptchaBundle\Service\GoogleCaptchaService;

class YourController extends AbstractController
{
    public function someAction(Request $request, GoogleCaptchaService $captchaService)
    {
        $result = $captchaService->verify($request);
        
        if ($result->success) {
            // reCAPTCHA passed
        } else {
            // reCAPTCHA failed
        }
    }
}

Frontend

Add Google reCAPTCHA script to your template:

<script src="https://www.google.com/recaptcha/api.js" async defer></script>
<div class="g-recaptcha" data-sitekey="your_site_key"></div>

Uninstallation

To remove the bundle:

  1. Delete configuration file:
rm config/packages/google_captcha.yaml
  1. Remove from composer:
composer remove sasa1007/google-captcha-bundle

Note: The bundle is automatically unregistered and service definitions are removed when you uninstall the package.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-08-05