lzakrzewski / http-event-store
与 http 事件存储 API 通信的客户端
0.0.5
2016-06-08 06:18 UTC
Requires
- php: >=5.6
- guzzlehttp/guzzle: ~6.0
- ramsey/uuid: ~3.0
Requires (Dev)
- phpunit/phpunit: ~5.0
This package is not auto-updated.
Last update: 2024-09-23 12:02:20 UTC
README
与 Event Store HTTP API
通信的客户端。了解更多关于 Event Store HTTP API
的信息 http://docs.geteventstore.com/http-api/latest。
这个库是 es-sandbox 的独立部分。
需求
"require": { "php": ">=5.6", "guzzlehttp/guzzle": "~6.0", "ramsey/uuid" : "~3.0" }
安装
使用 composer 安装库
composer require lzakrzewski/http-event-store
用法
示例
$streamId = Uuid::uuid4()->toString(); $eventStore = \HttpEventStore\Http\HttpEventStore::create('127.0.0.1', '2113'); $event1 = new \HttpEventStore\WritableEvent('productWasAddedToBasket', ['productId' => 'product1', 'name' => 'Teapot']); $event2 = new \HttpEventStore\WritableEvent('productWasRemovedFromBasket', ['productId' => 'product1']); // Writing to a Stream $eventStore->writeStream($streamId, [$event1, $event2]); // Reading from a Stream $events = $eventStore->readStream($streamId); // Your logic with events there...