- Notifications
You must be signed in to change notification settings - Fork17
cloudevents/sdk-php
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
PHP SDK forCloudEvents
This SDK currently supports the following versions of CloudEvents:
Install the SDK usingComposer:
composer require cloudevents/sdk-php
useCloudEvents\V1\CloudEvent;useCloudEvents\V1\CloudEventImmutable;// Immutable CloudEvent$immutableEvent =newCloudEventImmutable('1n6bFxDMHZFChlI4TVI9tdzphB9','/examples/php-sdk','com.example.type', ['example' =>'first-event'],'application/json');// Mutable CloudEvent$mutableEvent =newCloudEvent('1n6bFxDMHZFChlI4TVI9tdzphB9','/examples/php-sdk','com.example.type', ['example' =>'first-event'],'application/json');// Create immutable from mutable or via versa$event = CloudEventImmutable::createFromInterface($mutableEvent);$event = CloudEvent::createFromInterface($immutableEvent);
useCloudEvents\Serializers\JsonDeserializer;useCloudEvents\Serializers\JsonSerializer;// JSON serialization$payload = JsonSerializer::create()->serializeStructured($event);$payload = JsonSerializer::create()->serializeBatch($events);// JSON deserialization$event = JsonDeserializer::create()->deserializeStructured($payload);$events = JsonDeserializer::create()->deserializeBatch($payload);
useCloudEvents\Http\Marshaller;useCloudEvents\Http\Unmarshaller;// Marshal HTTP request$request = Marshaller::createJsonMarshaller()->marshalStructuredRequest($event);$request = Marshaller::createJsonMarshaller()->marshalBinaryRequest($event);$request = Marshaller::createJsonMarshaller()->marshalBatchRequest($events);// Marshal HTTP response$request = Marshaller::createJsonMarshaller()->marshalStructuredResponse($event);$request = Marshaller::createJsonMarshaller()->marshalBinaryResponse($event);$request = Marshaller::createJsonMarshaller()->marshalBatchResponse($events);// Unmarshal HTTP message$events = Unmarshaller::createJsonUnmarshaller()->unmarshal($message);
You can usecomposer to build and run test environments when contributing.
$ composer run -lscripts: lint Show all current linting errors according to PSR12 lint-fix Show and fix all current linting errors according to PSR12 sa Run the static analyzer tests Run all tests locally tests-build Build containers to test against supported PHP versions tests-docker Run tests within supported PHP version containers- There are bi-weekly calls immediately following theServerless/CloudEventscall at9am PT (US Pacific). Which means they will typically start at 10am PT, butif the other call ends early then the SDK call will start early as well.See theCloudEvents meeting minutesto determine which week will have the call.
- Slack: #cloudeventssdk channel underCNCF's Slack workspace.
- Email:https://lists.cncf.io/g/cncf-cloudevents-sdk
- Contact for additional information: Denis Makogon (
@denysmakogonon slack).
Each SDK may have its own unique processes, tooling and guidelines, commongovernance related material can be found in theCloudEventscommunitydirectory. In particular, in there you will find information concerninghow SDK projects aremanaged,guidelinesfor how PR reviews and approval, and ourCode of Conductinformation.
If there is a security concern with one of the CloudEvents specifications, orwith one of the project's SDKs, please send an email tocncf-cloudevents-security@lists.cncf.io.
About
PHP SDK for CloudEvents
Topics
Resources
License
Contributing
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Uh oh!
There was an error while loading.Please reload this page.
Contributors7
Uh oh!
There was an error while loading.Please reload this page.