PHP code example of sirsova / laravel-webhooks

1. Go to this page and download the library: Download sirsova/laravel-webhooks library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

sirsova / laravel-webhooks example snippets


'providers' => [
    ...
    SirSova\Webhooks\ServiceProvider::class,
]

use Illuminate\Contracts\Bus\QueueingDispatcher;
use SirSova\Webhooks\Jobs\ProcessMessage;
use SirSova\Webhooks\Message;
...

$busDispatcher = app(QueueingDispatcher::class);
$message = new Message('event-type', ['foo' => 'bar']);
$job = new ProcessMessage($message);

//queued message example
$busDispatcher->dispatchToQueue($job->onQueue('webhooks'));

//dispatching in time message
$busDispatcher->dispatch($job);

//queued webhook example
$webhook = new Webhook($message, 'https://example.com');
$job = new ProcessWebhook($webhook);
$busDispatcher->dispatchToQueue($job->onQueue('webhooks'));
bash
$ php artisan vendor:publish --tag=webhooks_config
bash
$ php artisan vendor:publish --tag=webhooks-migrations