定制 faaren-tech/webhook-receiver 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

faaren-tech/webhook-receiver

Composer 安装命令:

composer require faaren-tech/webhook-receiver

包简介

Build to receive webhooks.

README 文档

README

Open Tasks

  1. Add authorization logic (e.g. for Stripe)
  2. Custom table name

Webhook Receiver

This package will be used by all FAAREN Services which receive webhooks. It provides a basic structure to handle incoming webhooks. With this package you can simply define new endpoints for webhooks. Those webhooks will be stored within a database. Via a simple HandlerInterface you can define custom handlers for each of your endpoints.
This package also offers a basic CRUD functionality to interact with your stored webhooks via the Webhook model.

Installation

Call the following command:

composer require faaren-tech/webhook-receiver

The package is tested only for Laravel 8.x.

Config

Publish the relevant configuration file via (select the WebhookReceiverServiceProvider from the shown list):

php artisan vendor:publish 
  • You can customize the middleware separately for webhook endpoints and crud-routes.
  • You can customize the prefix for both the webhook endpoints and the crud-routes.

Creating new endpoints

It is very easy to add new endpoints to your application.

  1. Create a new webhook handler, e.g. MyExampleWebhookHandler within app/Http/WebhookEndpoints
  2. Implement FaarenTech\WebhookReceiver\Interfaces\WebhookEndpointHandlerInterface
  3. Add the endpoint to your config/webhook_receiver configuration file (see below)
  4. Set up your new endpoint within your webhook sender (e.g. MailJet, Stripe, etc) for the endpoint webhook/endpoints/my-example-endpoint
return [
    // other configuration options
    'endpoints' => [
        'my-example-endpoint' => MyExampleWebhookHandler::class
    ]
];

Example files

If you want you can take a look at the following files:

Testing

Add the relevant testsuite to your main phpunit.xml:

<testsuites>
    ...
    <testsuite name="FaarenTechWebhookReceiver">
        <directory suffix="Test.php">./vendor/faaren-tech/webhook-receiver</directory>
    </testsuite>
</testsuites>

统计信息

  • 总下载量: 9
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 5
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-02-01

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固