treblle/cloudevent-php

在PHP中创建云事件。

安装: 4

依赖: 0

建议者: 0

安全: 0

星星: 0

关注者: 1

分支: 0

类型:

dev-main 2024-05-15 12:09 UTC

This package is auto-updated.

Last update: 2024-09-15 12:53:50 UTC


README

欢迎使用云事件PHP仓库!这个库可以轻松地让您在PHP中创建和管理云事件。

目录

安装

使用Composer安装库

composer require treblle/cloudevent-php

用法

以下是一个创建云事件的基本示例

use Treblle\CloudEvent;

$event = new CloudEvent([
    'type' => 'com.example.someevent',
    'source' => '/mycontext',
    'id' => '1234-1234-1234',
    'time' => '2020-09-30T12:34:56Z',
    'data' => [
        'key' => 'value',
    ],
]);

echo $event->toJson();

然后您可以将云事件转换为HTTP流:$event->toStream()

功能

  • 轻松创建和管理云事件
  • 支持JSON序列化
  • 灵活的事件数据结构

许可证

本项目采用MIT许可证。有关详细信息,请参阅LICENSE文件。

更多信息,请访问GitHub仓库