Send events to Amazon EventBridge global endpoints
You can use Amazon EventBridge global endpoints to improve the availability and reliability of your event-driven applications.
After the EventBridge global endpoint is set up, you can send events to it by using the SDK for PHP.
Important
To use EventBridge global endpoints with the SDK for PHP, your PHP environment must have the AWS Common Runtime (AWS CRT) extension installed.
The following example uses the PutEvents method of the EventBridgeClient
to send a single event to
an EventBridge global endpoint.
<?php /* Send a single event to an existing Amazon EventBridge global endpoint. */ require '../vendor/autoload.php'; use Aws\EventBridge\EventBridgeClient; $evClient = new EventBridgeClient([ 'region' => 'us-east-1' ]); $endpointId = '
xxxx123456.xxx
'; // Existing EventBridge global endpointId. $eventBusName = 'default
'; // Existing event bus in the us-east-1 Region. $event = [ 'Source' => 'my-php-app', 'DetailType' => 'test', 'Detail' => json_encode(['foo' => 'bar']), 'Time' => new DateTime(), 'Resources' => ['php-script'], 'EventBusName' => $eventBusName, 'TraceHeader' => 'test' ]; $result = $evClient->putEvents([ 'EndpointId' => $endpointId, 'Entries' => [$event] ]);
This blog post