Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sadeghpm/recapcha
PSR-7 Google reCAPCHA Middleware
https://github.com/sadeghpm/recapcha
middleware php psr-7 recaptcha slim3 slimframework
Last synced: 3 months ago
JSON representation
PSR-7 Google reCAPCHA Middleware
- Host: GitHub
- URL: https://github.com/sadeghpm/recapcha
- Owner: SadeghPM
- License: mit
- Created: 2017-02-25T20:18:54.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2017-02-25T22:10:49.000Z (almost 8 years ago)
- Last Synced: 2024-04-21T21:32:15.536Z (10 months ago)
- Topics: middleware, php, psr-7, recaptcha, slim3, slimframework
- Language: PHP
- Size: 12.7 KB
- Stars: 12
- Watchers: 2
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# PSR-7 Google reCAPCHA Middleware
[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE.md)
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](https://getcomposer.org/).
``` bash
$ 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:
```php
$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 is403
and body is a json:
```json
{
"ok":false,
"description":"errors..."
}
```