Search by

lasselehtinen / mockingbird-webhook-client

lasleh

This package receives Mockingbird webhooks and convert them into strongly typed Laravel events.

Package info

github.com/lasselehtinen/mockingbird-webhook-client

pkg:composer/lasselehtinen/mockingbird-webhook-client

Fund package maintenance!

lasselehtinen

Statistics

Installs: 27

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v0.1.2 2026-09-26 09:28 UTC

This package is auto-updated.

Last update: 2026-09-26 09:35:34 UTC


README

Latest Version on Packagist run-tests Total Downloads

Mockingbird Webhook Client

This package receives Mockingbird webhooks and convert them into strongly typed Laravel events. Applications consume normal Laravel events and do not need to interact with raw webhook requests.

The package is built on top of spatie/laravel-webhook-client and provides:

  • Webhook endpoint registration
  • Payload parsing
  • Event mapping
  • Laravel event dispatching

Installation

composer require lasselehtinen/mockingbird-webhook-client
php artisan vendor:publish --tag="webhook-client-migrations"
php artisan migrate

You should schedule the model:prune Artisan command in your application's routes/console.php to clean up older than 30 days old entries from the webhook_calls table.

use Illuminate\Support\Facades\Schedule;
use Spatie\WebhookClient\Models\WebhookCall;

Schedule::command('model:prune', [
    '--model' => [WebhookCall::class],
])->daily();

Workflow

The package processes webhooks using the following flow:

Mockingbird
    ▼
POST /webhooks/mockingbird
    ▼
Spatie Webhook Controller
    ▼
WebhookCall persisted
    ▼
ProcessMockingbirdWebhookJob
    ▼
MockingbirdWebhookData DTO
    ▼
MockingbirdEventFactory
    ▼
Laravel Event
    ▼
Application Event Listener

Supported Event Types

Mockingbird event types are mapped to Laravel events.

  • AssetUpdated
  • EditionUpdated
  • ContactUpdated
  • EditionContributorsUpdated
  • EditionPriceUpdated
  • EditionTextsUpdated
  • PrintTimePlanUpdated

Webhook Endpoint

The package automatically registers:

POST /webhooks/mockingbird

Incoming requests are validated, stored and processed asynchronously.

Example usage

<?php

namespace App\Providers;

use App\Listeners\UpdateOnixMessage;
use App\Listeners\SyncContributorData;
use App\Listeners\UpdateMetadataInExternalAssetManagement;
use Lasselehtinen\MockingbirdWebhookClient\Events\AssetUpdated;
use Lasselehtinen\MockingbirdWebhookClient\Events\EditionContributorsUpdated;
use Lasselehtinen\MockingbirdWebhookClient\Events\EditionUpdated;
use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;

class EventServiceProvider extends ServiceProvider
{
    protected $listen = [

        EditionUpdated::class => [
            UpdateOnixMessage::class,
        ],

        EditionContributorsUpdated::class => [
            SyncContributorData::class,
        ],

        AssetUpdated::class => [
            UpdateMetadataInExternalAssetManagement::class,
        ],
    ];
}

Data Transfer Object

Every webhook is converted into a MockingbirdWebhookData DTO.

final readonly class MockingbirdWebhookData
{
    public string $eventType;
    public string $specVersion;
    public string $entityId;
    public string $deliveryId;
    public CarbonImmutable $occurredAt;
    public array $payload
}

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

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