oanhnn/laravel-webhook-notification

Integrate Webhook notification into Laravel 5.5+
1,966 2
Install
composer require oanhnn/laravel-webhook-notification
Latest Version:v0.1.0
PHP:^7.1.3
License:MIT
Last Updated:Dec 22, 2018
Links: GitHub  ·  Packagist
Maintainer: oanhnn

Introduction

Latest Version Software License Build Status Coverage Status Total Downloads Requires PHP

Easy send Webhook notification in Laravel 5.5+ Application

Requirements

  • php >=7.1.3
  • Laravel 5.5+

Installation

Begin by pulling in the package through Composer.

$ composer require oanhnn/laravel-webhook-notification

Usage

Implement webhook notifiable:


class User extends Authenticatable implements WebhookNotifiable
{
    use Notifiable;

    /**
     * @return string
     */
    public function getSigningKey(): string
    {
        return $this->api_key;
    }

    /**
     * @return string
     */
    public function getWebhookUrl(): string
    {
        return $this->webhook_url;
    }
}

In notification class,


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

    /**
     * @return array|WebhookMessage
     */
    public function toWebhook($notifiable)
    {
        return WebhookMessage::create()
            ->data([
               'payload' => [
                   'foo' => 'bar'
               ]
            ])
            ->userAgent("Custom-User-Agent")
            ->header('X-Custom', 'Custom-Header');
    }
}

See more in Laravel document

Changelog

See all change logs in CHANGELOG

Testing

$ git clone git@github.com/oanhnn/laravel-webhook-notification.git /path
$ cd /path
$ composer install
$ composer phpunit

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email to Oanh Nguyen instead of using the issue tracker.

Credits

License

This project is released under the MIT License.
Copyright © 2018 Oanh Nguyen.

Related Packages

onramplab/laravel-webhooks

The Laravel Webhook Package simplifies webhook dispatching in Laravel applicatio...

1,482 2
sohrabz/sms

A Laravel package for sending sms using iranian sms panels.

7 0
puz/laravel-discord-notification

Enables Laravel 5.3 notifications to be sent through discord webhooks.

10 0
jrenton/laravel-5-scaffold

Fastest way to rapidly scaffold a laravel application

268 4