PHP code example of tystr / sendgrid-bundle

1. Go to this page and download the library: Download tystr/sendgrid-bundle 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/ */

    

tystr / sendgrid-bundle example snippets



namespace Acme\Bundle;

use Tystr\Bundle\SendgridBundle\Event\WebHookEvent;

class SendgridListener
{
    public function onEmailBounce(WebHookEvent $event)
    {
        $this->logger->info('Address bounced: ' . $event-getEmail()->getOrElse('unknownEmail'));
    }
}

xml

    <service id="acme_sendgrid_listener" class="Acme\Bundle\SendgridListener">
        <tag name="kernel.event_listener" event="sendgrid.bounce" method="onEmailBounce" />
    </service>