Skip to content

Library agnostic to valid Google reCaptcha in PHP projects

License

Notifications You must be signed in to change notification settings

freddiegar/g-recaptcha

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Library agnostic to valid Google reCaptcha in PHP projects

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

About

Library agnostic to valid Google reCaptcha in PHP projects

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages