pascaldevink / cloudevents
CloudEvents规范(https://cloudevents.io/)的PHP实现
0.2
2020-03-28 19:59 UTC
Requires
- php: ^7.4
- ext-json: *
- league/uri: ^6.2
- webmozart/assert: ^1.3
Requires (Dev)
- phpunit/phpunit: ^7.0
- squizlabs/php_codesniffer: ^3.5
This package is auto-updated.
Last update: 2024-08-29 04:54:26 UTC
README
PHP实现CloudEvents。支持规范版本0.3。
安装
通过Composer
$ composer require pascaldevink/cloudevents
使用方法
$cloudEvent = new \PascalDeVink\CloudEvents\V03\CloudEvent( new EventId('89328232-6202-4758-8050-C9E4690431CA'), new Source(Uri::createFromString('github://pull')), new EventType('com.github.pull.create'), new SchemaUrl(Uri::createFromString('http://github.com/schema/pull')), new Subject('1234'), new EventTime(new DateTimeImmutable('2018-08-09T21:55:16+00:00')), null, JsonData::fromArray([]) ); $formatter = new \PascalDeVink\Format\JsonFormatter(); $jsonCloudEvent = $formatter->encode($cloudEvent); echo $jsonCloudEvent; $newCloudEvent = $formatter->decode($jsonCloudEvent);
测试
$ composer test
贡献
有关详细信息,请参阅CONTRIBUTING和CODE_OF_CONDUCT。
致谢
许可证
MIT许可证(MIT)。有关更多信息,请参阅许可证文件。