Downloads
Stars
Version
Easy send Webhook notification in Laravel 5.5+ Application
Begin by pulling in the package through Composer.
$ composer require oanhnn/laravel-webhook-notification
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
See all change logs in CHANGELOG
$ git clone [email protected]/oanhnn/laravel-webhook-notification.git /path
$ cd /path
$ composer install
$ composer phpunit
Please see CONTRIBUTING for details.
If you discover any security related issues, please email to Oanh Nguyen instead of using the issue tracker.
This project is released under the MIT License.
Copyright © 2018 Oanh Nguyen.