PHP code example of erwane / whep-brevo
1. Go to this page and download the library: Download erwane/whep-brevo 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-brevo example snippets
use WHEP\Exception\SecurityException;
use WHEP\Exception\WHEPException;
use WHEP\Factory;
try {
$provider = Factory::provider('brevo', [
'client_ip' => $_SERVER['REMOTE_ADDR'] ?? null, // Use method from your framework to get the ServerRequest client ip.
'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 ?
}