定制 bencoderus/laravel-webhook 二次开发

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

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

bencoderus/laravel-webhook

Composer 安装命令:

composer require bencoderus/laravel-webhook

包简介

The package allows clients/businesses to dispatch webhook to their users.

README 文档

README

Laravel webhook preview

Laravel Webhook

Latest Stable Version License Scrutinizer Code Quality Build Status

Laravel webhook allows businesses to send webhooks to their merchants/clients with ease. This package also introduces a new artisan command to generate a webhook class.

Requirement

  • Composer v1.0/2.0
  • Php (7.3 and above)
  • Laravel (6 and above).

Installation

You can install the package via composer:

composer require bencoderus/laravel-webhook

Setup

Publish basic components. (migrations and configuration files)

php artisan webhook:install

Run migrations

php artisan migrate

Basic usage

Create a new webhook class

php artisan make:webhook PaymentWebhook

Creates a new webhook class in App\Http\Webhooks

You can format your webhook payload like a resource.

public function data(): array
    {
        return [
            'status' => $this->status,
            'amount' => $this->amount,
            'currency' => 'USD',
        ];
    }

Sending a webhook.
$transaction = Transaction::first();

$webhook = new PaymentWebhook($transaction);
$webhook->url('https://httpbin.com')->send();

Sending with an encrypted signature

$transaction = Transaction::first();

$webhook = new PaymentWebhook($transaction);
$webhook->url('https://httpbin.com')
        ->withSignature('x-key', 'value_to_hash')
        ->send();

The default hashing algorithm is sha512 you can change it by passing a different hashing algorithm as the third parameter for the withSignature method. PHP currently supports over 50 hashing algorithms.

Sending webhooks without using a Queue.
By default, all webhooks are dispatched using a queue to facilitate webhook retrial after failure. You can also send webhooks without using a Queue by passing false to the send method.

$transaction = Transaction::first();

$webhook = new PaymentWebhook($transaction);
$webhook->url('https://httpbin.com')->send(false);

Testing

composer test

Configuration

  • You can enable or disable sending webhook via config/webhook.php.
  • You can also enable or disable logging webhook via config/webhook.php and more.

Changelog

Please see CHANGELOG for more information what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email me@biduwe.com instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.

统计信息

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

GitHub 信息

  • Stars: 23
  • Watchers: 1
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-03-23

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固