PHP code example of backend2-plus / google-captcha-bundle
1. Go to this page and download the library: Download backend2-plus/google-captcha-bundle library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
backend2-plus / google-captcha-bundle example snippets
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
}
}
}