lemonphp / webhook-shield
Protects against unverified webhooks from 3rd party services
v1.0.0
2019-10-17 10:07 UTC
Requires
- php: ^7.1
- psr/http-factory: ^1.0
- psr/http-message: ^1.0
- psr/http-server-handler: ^1.0
- psr/http-server-middleware: ^1.0
Requires (Dev)
- phpunit/phpunit: ^7.0
- squizlabs/php_codesniffer: ^3.2
This package is auto-updated.
Last update: 2024-09-17 21:56:23 UTC
README
Protects against unverified webhooks from 3rd party services.
Features
- Compatible with PSR-7, PSR-15 and PSR-17
- No dependencies
- Supported drivers
- Bitbucket
- Github
- Gitlab
- Mailgun
- Shopify
- Trello
- Coding style follow PSR-2, PSR-4
Requirements
- php >=7.1
Installation
Begin by pulling in the package through Composer.
$ composer require lemonphp/webhook-shield
Usage
Slim 4
-
Installation Slim application follow link http://www.slimframework.com/docs/v4/start/installation.html
$ composer require slim/slim slim/psr7 lemonphp/webhook-shield
-
Make
public/index.php
with below content<?php use Lemon\WebhookShield\ServiceProfiles\Facebook; use Lemon\WebhookShield\WebhookShieldMiddleware; use Psr\Http\Message\ResponseInterface as Response; use Psr\Http\Message\ServerRequestInterface as Request; use Slim\Factory\AppFactory; require __DIR__ . '/../vendor/autoload.php'; $app = AppFactory::create(); $shield = new WebhookShieldMiddleware(new Facebook('secret'), $app->getResponseFactory()); $app->post('/webhook/facebook', function (Request $req, Response $res, $args) { // TODO: Add webhook event to message queue return $res->withStatus(200, 'OK'); })->add($shield); // other routes $app->run();
Changelog
See all change logs in CHANGELOG
Testing
$ git clone git@github.com/lemonphp/webhook-shield.git /path $ cd /path $ composer install $ composer test
Contributing
Please see CONTRIBUTING for details.
Security
If you discover any security related issues, please email to Oanh Nguyen instead of using the issue tracker.
Credits
License
This project is released under the MIT License.
Copyright © 2019 LemonPHP Team.