PHP code example of synida / aws-event-bridge-wrapper

1. Go to this page and download the library: Download synida/aws-event-bridge-wrapper 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/ */

    

synida / aws-event-bridge-wrapper example snippets


// You put whatever details you want to pass in this array
$detailArray = [
    'task_id' => (new RandomGenerator())->uuid(),
    'revisions' => [
        'id' => 'edit',
        's3_path'=> "s3://{$bucket}/{$s3Key}"
    ]
];

$entryObject = new EventEntry([
    'Source' => 'some.source',
    'DetailType' => 'some.detail.type',
    'Detail' => json_encode($detailArray, JSON_THROW_ON_ERROR)
    // ect..
]);

$entriesJson = json_encode([$entryObject], JSON_THROW_ON_ERROR)

$defaultPath = 'someFilePath';
$filePath = "{$defaultPath}/someFilename.json";

file_put_contents($filePath, $entriesJson);

$awsEBCli = new EventBridge(['entries' => "file://$filePath"]);

$result = $awsEBCli->putEvents();