broadway/broadway-demo
Composer 安装命令:
composer require broadway/broadway-demo
包简介
Demo application that uses Broadway
README 文档
README
This repository contains a demo application to show how Broadway can be used within a Symfony application. The example is taken from the Practical Event Sourcing talk from Mathias Verraes.
For simplicity the demo uses the official DBAL event store and a custom DBAL read model implementation. You will need to have SQLite installed to run the demo.
Running the demo
composer install
bin/console broadway:event-store:create
bin/console broadway:read-model:create
bin/console server:run
This demo doesn't have a GUI, only an API with the following endpoints:
| Method | Path | Description |
|---|---|---|
| POST | /basket |
Pick up a new basket, returns the basketId |
| POST | /basket/{basketId}/addProduct |
Add a product to a basket (productId and productName should be given as form fields) |
| POST | /basket/{basketId}/removeProduct |
Remove a product from a basket (productId as form field) |
| POST | /basket/{basketId}/checkout |
Check out a basket |
| GET | /advice/{productId} |
Retrieve Other people also bought this list |
# pick up a new basket $ curl -X POST http://localhost:8000/basket { "id":"1bd683ac-f75d-403f-babc-82ddcdb33de7" } # add products to the basket $ curl -d "productId=2009&productName=Incredibad" -X POST http://localhost:8000/basket/1bd683ac-f75d-403f-babc-82ddcdb33de7/addProduct $ curl -d "productId=2011&productName=Turtleneck+%26+Chain" -X POST http://localhost:8000/basket/1bd683ac-f75d-403f-babc-82ddcdb33de7/addProduct $ curl -d "productId=2013&productName=The+Wack+Album" -X POST http://localhost:8000/basket/1bd683ac-f75d-403f-babc-82ddcdb33de7/addProduct # remove a product from the basket curl -d "productId=2009" -X POST http://localhost:8000/basket/1bd683ac-f75d-403f-babc-82ddcdb33de7/removeProduct # check out the basket $ curl -X POST http://localhost:8000/basket/1bd683ac-f75d-403f-babc-82ddcdb33de7/checkout # get _Other people also bought this_ list $ curl http://localhost:8000/advice/2011 { "purchasedProductId": 2011, "otherProducts": { "2009": 1, "2013": 1 } }
Running the tests
To run all the tests:
./vendor/bin/phpunit
Code structure
- Domain code can be found in
src/Basket - ReadModel code can be found in
src/ReadModel - Controllers can be found in
src/Controllers
Note that there are two files for the services: services.yaml and domain.yaml.
domain.yaml contains all the domain-specific services (CommandHandler,
ReadModels, Repositories), while services.yaml contains domain-unspecific
services (controllers etc).
The domain specific tests can be found in test/Basket and test/ReadModel
Note that there is a functional test in test/Functional
For more information, read our blog post about this demo: http://labs.qandidate.com/blog/2014/12/30/a-broadway-demo-application/
broadway/broadway-demo 适用场景与选型建议
broadway/broadway-demo 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 19 次下载、GitHub Stars 达 87, 最近一次更新时间为 2016 年 11 月 29 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 broadway/broadway-demo 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 broadway/broadway-demo 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 19
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 87
- 点击次数: 2
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2016-11-29