定制 laravel-notification-channels/webhook 二次开发

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

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

laravel-notification-channels/webhook

Composer 安装命令:

composer require laravel-notification-channels/webhook

包简介

Webhook Notifications driver

README 文档

README

Latest Version on Packagist Software License Build Status StyleCI SensioLabsInsight Quality Score Code Coverage Total Downloads

This package makes it easy to send webhooks using the Laravel notification system.

Compatibility

Laravel version PHP version Package version
^6.0 | ^7.0 | ^8.0 | ^9.0 | ^10.0 ^7.2.5 | ^8.0 ^2.4
^6.0 | ^7.0 | ^8.0 | ^9.0 ^7.2.5 | ^8.0 ^2.3
^6.0 | ^7.0 | ^8.0 ^7.2.5 | ^8.0 ^2.2
^6.0 | ^7.0 | ^8.0 ^7.2.5 ^2.1
~5.5 | ~6.0 | ~7.0 >=7.2.5 ^2.0
~5.5 | ~6.0 >=7.0 ^1.3
5.1.* | 5.2.* | 5.3.* | 5.4.* | 5.5.* | 5.6.* >=5.6.4 ^1.2
5.1.* | 5.2.* | 5.3.* | 5.4.* | 5.5.* >=5.6.4 ^1.1
5.1.* | 5.2.* | 5.3.* | 5.4.* >=5.6.4 ^1.0.2
5.1.* | 5.2.* | 5.3.* >=5.6.4 ^1.0.0

Contents

Installation

You can install the package via composer:

composer require laravel-notification-channels/webhook

Usage

Now you can use the channel in your via() method inside the notification:

use NotificationChannels\Webhook\WebhookChannel;
use NotificationChannels\Webhook\WebhookMessage;
use Illuminate\Notifications\Notification;

class ProjectCreated extends Notification
{
    public function via($notifiable)
    {
        return [WebhookChannel::class];
    }

    public function toWebhook($notifiable)
    {
        return WebhookMessage::create()
            ->data([
               'payload' => [
                   'webhook' => 'data'
               ]
            ])
            ->userAgent("Custom-User-Agent")
            ->header('X-Custom', 'Custom-Header');
    }
}

In order to let your Notification know which URL should receive the Webhook data, add the routeNotificationForWebhook method to your Notifiable model.

This method needs to return the URL where the notification Webhook will receive a POST request.

public function routeNotificationForWebhook()
{
    return 'http://requestb.in/1234x';
}

Available methods

  • data(''): Accepts a JSON-encodable value for the Webhook body.
  • query(''): Accepts an associative array of query string values to add to the request.
  • userAgent(''): Accepts a string value for the Webhook user agent.
  • header($name, $value): Sets additional headers to send with the POST Webhook.
  • verify(): Enable the SSL certificate verification or provide the path to a CA bundle

Changelog

Please see CHANGELOG for more information what has changed recently.

Testing

$ composer test

Security

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

Contributing

Please see CONTRIBUTING for details.

Credits

License

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

laravel-notification-channels/webhook 适用场景与选型建议

laravel-notification-channels/webhook 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1.04M 次下载、GitHub Stars 达 177, 最近一次更新时间为 2016 年 08 月 14 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 laravel-notification-channels/webhook 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 laravel-notification-channels/webhook 我们能提供哪些服务?
定制开发 / 二次开发

基于 laravel-notification-channels/webhook 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 1.04M
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 177
  • 点击次数: 19
  • 依赖项目数: 7
  • 推荐数: 2

GitHub 信息

  • Stars: 177
  • Watchers: 8
  • Forks: 65
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-08-14