freddiegar / g-recaptcha
Library agnostic to connect/valid Google Recaptcha in PHP projects
Installs: 1 598
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Requires
- php: >=5.6
Requires (Dev)
- phpunit/phpunit: >=4.8
This package is auto-updated.
Last update: 2025-03-06 10:03:50 UTC
README
Valid g-ReCaptcha 2.0 in your back-end project
You can view details to back-end integration in docs
Use example
$params = [ 'secret' => 'YOUR_SECRET_FROM_RECAPTCHA', 'reCaptcha' => $_POST['g-recaptcha-response'] // Optional parameters 'userAgent' => 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.108 Safari/537.36' 'ipAddress' => '127.0.0.1', ]; try { $captcha = new ReCaptcha2($params); $request = $captcha->request(); if ($request->isValid()) { // Dont is bot, ready! } else { $error = $captcha->getErrors(); } } catch (Exception $exception) { $error = $exception->getMessage(); }
Side Client
You can view details to front-end integration in docs