sadegh-pm/recapcha

PSR-7 Google reCAPCHA Middleware

v1.0 2017-02-25 21:24 UTC

This package is auto-updated.

Last update: 2024-12-05 00:23:24 UTC


README

Software License
This middleware implement server side google reCAPCHA v2 validation.It was originally developed for Slimframework 3 but can be used with any framework using PSR-7 style middlewares. It is very simple and without any dependancy.

Install

Install latest version using composer.

$ composer require sadegh-pm/recapcha

Usage

Add the middleware in the route that you rendering the reCAPTCHA widget. for example i inserted reCAPTCHA widget in the /login route:

  $app->post('/login', App\Api\Login::class . ':verify')
      ->add( new \SadeghPM\Recapcha\GoogleReCapcha($reCAPCHA_Secret) );

if google reCAPCHA verifying the user's response , your route will be resolved otherwise app will be terminate.the terminated response status code is 403 and body is a json:

{
  "ok":false,
  "description":"errors..."
}