sfue / re-captcha-bundle
Google reCAPTCHA symfony 表单类型和验证器
v1.0.1
2018-05-13 21:41 UTC
Requires
- php: >=7.0
- google/recaptcha: ^1.1
- symfony/framework-bundle: ~3.2|~4.0
Requires (Dev)
- symfony/phpunit-bridge: ^4.0
- symfony/security-bundle: ^3.2 || ^4.0
This package is not auto-updated.
Last update: 2024-09-29 05:41:57 UTC
README
安装
通过 Composer 安装包
$ composer require sfue/re-captcha-bundle
将包添加到您的 AppKernel
// app/AppKernel.php <?php public function registerBundles() { $bundles = array( // ... new new Sfue\ReCaptchaBundle\SfueReCaptchaBundle(), ); }
将包的主题添加到您的 twig 配置中
sfue_re_captcha: site_key: 'your Google reCAPTCHA site key' secret: 'your Google reCAPTCHA secret'
将包的主题添加到您的 twig 配置中
# Twig Configuration twig: form_themes: - '@SfueReCaptcha/Form/fields.html.twig'
在需要 reCAPTCHA 字段的任何表单中使用 ReCaptchaType
public function buildForm(FormBuilderInterface $builder, array $options) { $builder // ... ->add('recaptcha', ReCaptchaType::class) ; }