• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

laravel-notification-channels/webhook: Webhook notifications channel for Laravel

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称(OpenSource Name):

laravel-notification-channels/webhook

开源软件地址(OpenSource Url):

https://github.com/laravel-notification-channels/webhook

开源编程语言(OpenSource Language):

PHP 100.0%

开源软件介绍(OpenSource Introduction):

Webhook notifications channel for Laravel

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. Supports 5.5+, 6.x, 7.x and 8.x.

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 [email protected] 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.




鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
framgia/laravel-test-examples发布时间:2022-07-09
下一篇:
dyarleniber/laravel7-docker: PHP 7.4 development environment with PHP-FPM, Nginx ...发布时间:2022-07-09
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap