Publish and Subscribe with PHP

    With Dapr, you can publish anything, including cloud events. The SDK contains a simple cloud event implementation, but you can also just pass an array that conforms to the cloud event spec or use another library.

    The PHP SDK allows setting the data content type either when constructing a custom cloud event, or when publishing raw data.

    Binary data

    Receiving cloud events

    In your subscription handler, you can have the DI Container inject either a or an into your controller. The former does some validation to ensure you have a proper event. If you need direct access to the data, or the events do not conform to the spec, use an .