Skip to content

Commit

Permalink
Merge pull request #2 from Phauthentic/develop
Browse files Browse the repository at this point in the history
Tests & Documentation
  • Loading branch information
floriankraemer authored Jul 12, 2024
2 parents 1a205e3 + c97883a commit 22b66fb
Show file tree
Hide file tree
Showing 49 changed files with 1,283 additions and 542 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@
infection.log
*.drawio.bkp
*.drawio.dtmp

.env
phpunit.xml
2 changes: 1 addition & 1 deletion .idea/eventsourcing.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 6 additions & 2 deletions .idea/php.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

34 changes: 34 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
.DEFAULT_GOAL := help

help:
@echo "Available commands:"
@echo " - run-tests: Run tests"
@echo " - run-infection: Runs Infection mutation testing"
@echo " - coverage-text: Runs coverage text"
@echo " - coverage-html: Runs coverage html"
@echo " - all: Runs CS-Fixer, CS-Checker, Static Analyser and Tests"
@echo " - shell: Run shell"

run-tests:
@echo "Running tests"
docker compose run php composer test

run-infection:
@echo "Running infection mutation testing"
docker compose run php composer infection

coverage-text:
@echo "Running coverage text"
docker compose run php composer test-coverage

coverage-html:
@echo "Running coverage text"
docker compose run php composer test-coverage-html

all:
@echo "Running CS-Fixer, CS-Checker, Static Analyser and Tests"
docker compose run php composer all

shell:
@echo "Running shell"
docker compose run --service-ports --entrypoint /bin/bash php
39 changes: 7 additions & 32 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,6 @@ It features different ways of extracting information from your aggregates, pick
* Via Interfaces
* Via Reflection

## What is Event Sourcing?

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.

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.

## When to NOT use it

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.

If you have no good reason to use it, then don't.

## Installation

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

## Documentation

Please start by reading [the docs folder](/docs/Index.md) in this repository.

## Other Event Sourcing Libraries

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.

It would be nice if you could tell us why you preferred another library, thank you!

### [Event Sauce](https://eventsauce.io/)

A wide used an well know library.

### [Prooph Event Sourcing](https://github.com/prooph/event-sourcing)

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.

### [Patchlevel Event Sourcing](https://github.com/patchlevel/event-sourcing)

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.
* [What is Event Sourcing?](docs/What-is-Event-Sourcing)
* [The Architecture of this Library](docs/Architecture.md)
* [Make your Aggregates Using Event Sourcing](docs/Make-your-Aggregate-using-Event-Sourcing.md)
* [Example](docs/Example.md)
* [Running Tests](docs/Running-Tests.md)
* [Other Event Sourcing Libraries](docs/Other-Event-Sourcing-Libraries.md)

## License

Copyright Florian Krämer

Licensed under the [MIT license](license.txt).
Licensed under the [MIT license](LICENSE).
6 changes: 6 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@
"test": [
"phpunit"
],
"infection": [
"infection"
],
"test-coverage": [
"phpunit --coverage-text"
],
Expand All @@ -73,6 +76,9 @@
"analyze": [
"phpstan analyse src/"
],
"phpmd": [
"bin/phpmd ./src text cleancode,codesize,controversial,design"
],
"all": [
"@csfix",
"@cscheck",
Expand Down
Loading

0 comments on commit 22b66fb

Please sign in to comment.