Skip to content

Commit 22b66fb

Browse files
Merge pull request #2 from Phauthentic/develop
Tests & Documentation
2 parents 1a205e3 + c97883a commit 22b66fb

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+1283
-542
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,5 @@
77
infection.log
88
*.drawio.bkp
99
*.drawio.dtmp
10-
10+
.env
11+
phpunit.xml

.idea/eventsourcing.iml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/php.xml

Lines changed: 6 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Makefile

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
.DEFAULT_GOAL := help
2+
3+
help:
4+
@echo "Available commands:"
5+
@echo " - run-tests: Run tests"
6+
@echo " - run-infection: Runs Infection mutation testing"
7+
@echo " - coverage-text: Runs coverage text"
8+
@echo " - coverage-html: Runs coverage html"
9+
@echo " - all: Runs CS-Fixer, CS-Checker, Static Analyser and Tests"
10+
@echo " - shell: Run shell"
11+
12+
run-tests:
13+
@echo "Running tests"
14+
docker compose run php composer test
15+
16+
run-infection:
17+
@echo "Running infection mutation testing"
18+
docker compose run php composer infection
19+
20+
coverage-text:
21+
@echo "Running coverage text"
22+
docker compose run php composer test-coverage
23+
24+
coverage-html:
25+
@echo "Running coverage text"
26+
docker compose run php composer test-coverage-html
27+
28+
all:
29+
@echo "Running CS-Fixer, CS-Checker, Static Analyser and Tests"
30+
docker compose run php composer all
31+
32+
shell:
33+
@echo "Running shell"
34+
docker compose run --service-ports --entrypoint /bin/bash php

README.md

Lines changed: 7 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,6 @@ It features different ways of extracting information from your aggregates, pick
1414
* Via Interfaces
1515
* Via Reflection
1616

17-
## What is Event Sourcing?
18-
19-
Event sourcing is a software architecture pattern that emphasizes capturing and persisting the state of an application as a sequence of events rather than storing the current state directly. In event sourcing, every state-changing operation, or event, is stored in an append-only log. The current state of an entity is reconstructed by replaying these events in sequence.
20-
21-
This approach provides a comprehensive audit trail of all changes, enabling traceability, versioning, and the ability to rebuild the system's state at any point in time. Event sourcing promotes a decentralized and scalable model, facilitating event-driven architectures and supporting the evolution of domain models over time, making it particularly suitable for complex business domains and systems where temporal aspects and historical data are crucial.
22-
23-
## When to NOT use it
24-
25-
Event sourcing comes with additional complexity. You should NOT use event sourcing when you don't need it. It is a powerful tool, but it is not a silver bullet. It is not a one-size-fits-all solution. Event sourcing is a good solution for scenarious like audit logging, undo/redo functionality, and complex business rules.
26-
27-
If you have no good reason to use it, then don't.
28-
2917
## Installation
3018

3119
```sh
@@ -34,28 +22,15 @@ composer require phauthentic/event-sourcing
3422

3523
## Documentation
3624

37-
Please start by reading [the docs folder](/docs/Index.md) in this repository.
38-
39-
## Other Event Sourcing Libraries
40-
41-
If you don't like this library, you might get happy with one of those. We think that different libraries for the same purpose approach the same problem from different angles and probably for different skill levels and audiences. Therefor we are happy to provide you with a list of alternatives.
42-
43-
It would be nice if you could tell us why you preferred another library, thank you!
44-
45-
### [Event Sauce](https://eventsauce.io/)
46-
47-
A wide used an well know library.
48-
49-
### [Prooph Event Sourcing](https://github.com/prooph/event-sourcing)
50-
51-
A very well engineered library, but it seems to be unmaintained. Some might even call it over-engineered, however it is a very good library.
52-
53-
### [Patchlevel Event Sourcing](https://github.com/patchlevel/event-sourcing)
54-
55-
A library that is very tightly coupled with Symfony and Doctrine. It has a lot of dependencies and is not as flexible as the other libraries.
25+
* [What is Event Sourcing?](docs/What-is-Event-Sourcing)
26+
* [The Architecture of this Library](docs/Architecture.md)
27+
* [Make your Aggregates Using Event Sourcing](docs/Make-your-Aggregate-using-Event-Sourcing.md)
28+
* [Example](docs/Example.md)
29+
* [Running Tests](docs/Running-Tests.md)
30+
* [Other Event Sourcing Libraries](docs/Other-Event-Sourcing-Libraries.md)
5631

5732
## License
5833

5934
Copyright Florian Krämer
6035

61-
Licensed under the [MIT license](license.txt).
36+
Licensed under the [MIT license](LICENSE).

composer.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,9 @@
5858
"test": [
5959
"phpunit"
6060
],
61+
"infection": [
62+
"infection"
63+
],
6164
"test-coverage": [
6265
"phpunit --coverage-text"
6366
],
@@ -73,6 +76,9 @@
7376
"analyze": [
7477
"phpstan analyse src/"
7578
],
79+
"phpmd": [
80+
"bin/phpmd ./src text cleancode,codesize,controversial,design"
81+
],
7682
"all": [
7783
"@csfix",
7884
"@cscheck",

0 commit comments

Comments
 (0)