kleegroup / google-recaptcha-bundle
Symfony Google Recaptcha 表单类型
1.0.3
2018-11-30 09:24 UTC
Requires
- php: >=5.5.9
- google/recaptcha: ^1.1.3
- symfony/symfony: ^3.0 | ^4.0
Requires (Dev)
- phpunit/phpunit: ~5.4
- symfony/phpunit-bridge: ^3.0
This package is not auto-updated.
Last update: 2024-09-13 23:21:20 UTC
README
Symfony 3 的 Google Recaptcha 包,支持代理配置。
步骤 1:设置包
1) 将 GoogleRecaptchaBundle 添加到项目中
composer require kleegroup/google-recaptcha-bundle
2) 启用包
在内核中启用包
// app/AppKernel.php public function registerBundles() { $bundles = array( // ... new KleeGroup\GoogleReCaptchaBundle\GoogleReCaptchaBundle(), ); }
步骤 2:配置包
// config.yml [...] google_re_captcha: site_key: [Google_site_key] secret_key: [Google_secret_key] enabled: true/false ajax: true/false locale_key: [locale_key] http_proxy: host: [IP or hostname] port: [Port]
步骤 3:使用
public function buildForm( FormBuilderInterface $builder, array $options) { [...] $builder ->add('recaptcha', ReCaptchaType::class, [ 'mapped' => false, 'constraints' => [ new ReCaptcha(), ], ] ); [...] }