putheng/webhooks

There is no license information available for the latest version (1.0) of this package.

Laravel webhooks package

1.0 2019-01-30 06:16 UTC

This package is auto-updated.

Last update: 2025-05-29 01:36:06 UTC


README

Require this package with composer.

composer require putheng/webhooks

Laravel 5.5 uses Package Auto-Discovery, so doesn't require you to manually add the ServiceProvider.

Setting up from scratch

Laravel 5.5+:

If you don't use auto-discovery, add the ServiceProvider to the providers array in config/app.php

Putheng\Webhooks\WebhooksServiceProvider::class,

Schema

For Laravel 5 migration php artisan migrate

Model

Event

Add WebhookEventSubscriber to protected $subscribe property on EventServiceProvider. We can create if protected $subscribe property doesn't exists

protected $subscribe = [
    \Putheng\Webhooks\Listeners\WebhookEventSubscriber::class
];

Create an event php artisan event:webhook EventName

Updatepublic $webhookName property on EventName that we just generated. this name should match event column on webhook_preferences table. by default this use snake_case of reflection class. example: EventName will be event_name by default

public $webhookName = 'name';

Queue

by default webhook event queue will be set onQueue to webhooks. if we set queue connection to database, artisan command should be php artisan queue:listen --queue=webhooks