2017 © Pedro Peláez
 

library webhook

Webhook Notifications driver

image

laravel-notification-channels/webhook

Webhook Notifications driver

  • Monday, May 7, 2018
  • by laravel-notification-channels
  • Repository
  • 3 Watchers
  • 54 Stars
  • 14,246 Installations
  • PHP
  • 2 Dependents
  • 0 Suggesters
  • 23 Forks
  • 7 Open issues
  • 6 Versions
  • 32 % Grown

The README.md

Webhook notifications channel for Laravel

Latest Version on Packagist Software License Build Status StyleCI SensioLabsInsight Quality Score Code Coverage Total Downloads, (*1)

This package makes it easy to send webhooks using the Laravel notification system., (*2)

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:, (*3)

``` bash composer require laravel-notification-channels/webhook, (*4)


## Usage Now you can use the channel in your `via()` method inside the notification: ``` php 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., (*5)

This method needs to return the URL where the notification Webhook will receive a POST request., (*6)

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., (*7)

Testing

bash $ composer test, (*8)

Security

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

Contributing

Please see CONTRIBUTING for details., (*10)

Credits

License

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

The Versions