PSR-7 Google reCAPCHA Middleware
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
SadeghPM 77f5c7e435 Update GoogleReCapcha.php 5 years ago
src Update GoogleReCapcha.php 5 years ago
LICENSE Initial commit 5 years ago Update 5 years ago
composer.json Update composer.json 5 years ago

PSR-7 Google reCAPCHA Middleware

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 latest version using composer.

$ composer require sadegh-pm/recapcha


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: