rva-vzw/krakboem
Composer 安装命令:
composer require rva-vzw/krakboem
包简介
Interfaces and some classes for CQRS and event sourcing
README 文档
README
This package contains interfaces and some classes I use for the event-sourced software I write in php.
I created it to learn about event sourcing. If you want to use it, you can (under the conditions of the GNU Affero General Public License), but as it turns out, my opinion on how to do event sourcing in PHP is always changing, so this is not a stable package. (I had the intention of making it stable by releasing version 1.0, but I failed.)
For the moment, I have these projects that use krakboem:
- dikdikdik, my famous app to keep track of the score of the solo whist card game.
- kaarten, a modest webshop to sell concert tickets.
- wdebelek, a web app to play card games. We used it in Covid times.
- 1jg, another score app.
Expect these changes for version 2:
Almost everything changes:
- New namespaces
- I will provide basic implementations for the various buses, that don't depend on Symfony Messenger. (Because I never really used the advanced features of Symfony Messenger.) You should be able to use Symfony Messenger in your own implementation of the various buses though.
- ~~No more support for the old Aggregate class and the old
EventSourcedWriteModelRepository. I will use deciders from now on.~~
I will re-add the
Aggregateclass, because I ran into problems with deciders and clean architecture. The decider implementation I use forces me to have commands in the Domain, and I want them in Application. - Use the normalizer of Symfony 7 (I want to decouple from Symfony normalizer as well, but probably not in version 2 of krakboem).
- ~Use cool new php 8.4 features~ (I added property hooks in #41,
but I removed them again, because I like to keep the
Commands and Events
readonly.)
How to install the package:
composer require rva-vzw/krakboem
It's recommended to also require the rva-vzw/krakboem-phpunit package so that you can create
'given-when-then'-tests easily.
composer require --dev rva-vzw/krakboem-phpunit:dev-main
Please check out the test examples here:
- https://gitlab.com/rva-vzw/krakboem-phpunit/-/blob/main/tests/Decider/ExampleDeciderTest.php
- https://gitlab.com/rva-vzw/krakboem-phpunit/-/blob/main/tests/Aggregate/ExampleAggregateTest.php
Running the tests with XDebug
If you are developing on this library, it can be useful to run the tests with XDebug. I provided a docker-compose.yml file that should make it rather easy to do with Linux and PhpStorm.
Build and run the php container:
docker compose up -d
Configure a server in PhpStorm
- Settings, PHP, Servers
- Add a server
- Name: krakboem-xdebug
- Host: irrelevant; this is not a webapp. You can type 'localhost'
- Use path mappings: Map your project's root to /opt/app
I thought this would be enough for it to work when clicking 'Start Listening for PHP Debug Connections', and running the tests as
docker compose exec php sh -c "make test"
So:
Using a runtime configuration
Go to the Run/Debug configurations in PHPStorm:
"Run" > "Edit configurations..."
Add a new configuration:
- Select "PHP Remote Debug"
- Name: Xdebug on Docker
- Filter debug connection by IDE key: false
Now select "Xdebug on Docker" in the debug toolbar thingy, and click the icon on the right ('Run "Xdebug on docker"').
Run your tests within docker, e.g. like this:
docker compose exec php sh -c "make test"
rva-vzw/krakboem 适用场景与选型建议
rva-vzw/krakboem 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 2.22k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2020 年 03 月 30 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 rva-vzw/krakboem 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 rva-vzw/krakboem 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 2.22k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 8
- 依赖项目数: 2
- 推荐数: 0
其他信息
- 授权协议: AGPL-3.0-or-later
- 更新时间: 2020-03-30