1. Go to this page and download the library: Download juststeveking/cloudevents 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/ */
juststeveking / cloudevents example snippets
use JustSteveKing\CloudEvents\CloudEvent;
$event = new CloudEvent(
id => '1234',
source => '/some-url',
type => 'com.vendor.action.event',
data => json_encode(['foo' => 'bar'], JSON_THROW_ON_ERROR),
dataContentType => 'application/json',
data_schema => null,
subject => 'cloud-event.json',
time => '01/01/1234',
);