erwane/whep-mailgun

Mailgun (Sinch) webhooks handler

2.2.0 2025-08-13 08:47 UTC

This package is auto-updated.

Last update: 2025-08-13 09:20:30 UTC


README

Software License codecov CI Packagist Downloads Packagist Version

Webhook handler for Mailgun (Sinch) emailing provider.

Usage

composer require erwane/whep-mailgun
use WHEP\Exception\SecurityException;  
use WHEP\Exception\WHEPException;  
use WHEP\Factory;  

try {
    $provider = Factory::provider('mailgun', [
        'signing_key' => 'my-private-signing-key',
        'callbacks' => [
            ProviderInterface::EVENT_BLOCKED => [$this, 'callbackInvalidate'],
            ProviderInterface::EVENT_BOUNCE_QUOTA => [$this, 'callbackUnsub'],
        ],
    ]);

    // process the data.
    $provider->process($webhookData);
    
    // Data available from provider getters.
    $recipient = $provider->getRecipient();
    
    // Launch callbacks
    $provider->callback();
} catch (SecurityException $e) {
    // log ?
} catch (WHEPException $e) {
    // log ?
}

See WHEP Client README for options, events and getters.