PHP code example of erwane / whep-mailgun
1. Go to this page and download the library: Download erwane/whep-mailgun 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/ */
erwane / whep-mailgun example snippets
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 ?
}