PHP code example of settermjd / twilio-eventstreams-webhook-validator-slim

1. Go to this page and download the library: Download settermjd/twilio-eventstreams-webhook-validator-slim 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/ */

    

settermjd / twilio-eventstreams-webhook-validator-slim example snippets




declare(strict_types=1);

bhookValidatorMiddleware;
use Twilio\Security\RequestValidator;

$app = new \Slim\App();

$eventStreamsWebhookValidatorMiddleware = new EventStreamsWebhookValidatorMiddleware(
    "<<THE APP'S PUBLIC URL>>",
    "<<THE WEBHOOK PATH>>",
     new RequestValidator("<<YOUR TWILIO AUTH TOKEN>>")
);

$app->get('/', function ($request, $response, $args) {
    $response->getBody()->write(' Hello ');
    return $response;
})->add($eventStreamsWebhookValidatorMiddleware);

$app->run();