Skip to content

Commit

Permalink
Merge pull request #440 from patchlevel/improve-docs
Browse files Browse the repository at this point in the history
improve readme, index and getting started docs
  • Loading branch information
DavidBadura authored Feb 1, 2024
2 parents 43f8f1f + 8ba72a4 commit a4d782f
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 29 deletions.
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ A lightweight but also all-inclusive event sourcing library with a focus on deve
* Everything is included in the package for event sourcing
* Based on [doctrine dbal](https://github.com/doctrine/dbal) and their ecosystem
* Developer experience oriented and fully typed
* [Snapshots](https://patchlevel.github.io/event-sourcing-docs/latest/snapshots/) system to quickly rebuild the aggregates
* Allow to [Split-Stream](https://patchlevel.github.io/event-sourcing-docs/latest/split_stream/) for big aggregates
* [Pipeline](https://patchlevel.github.io/event-sourcing-docs/latest/pipeline/) to export,import and migrate events
* [Projectionist](https://patchlevel.github.io/event-sourcing-docs/latest/projection/) to manage versioned projections
* [Upcast](https://patchlevel.github.io/event-sourcing-docs/latest/upcasting/) old events
* [Scheme management](https://patchlevel.github.io/event-sourcing-docs/latest/store/) and [doctrine migration](https://patchlevel.github.io/event-sourcing-docs/latest/migration/) support
* Dev [tools](https://patchlevel.github.io/event-sourcing-docs/latest/watch_server/) such as a realtime event watcher
* Automatic [snapshot](https://patchlevel.github.io/event-sourcing-docs/latest/snapshots/)-system to boost your performance
* [Split](https://patchlevel.github.io/event-sourcing-docs/latest/split_stream/) big aggregates into multiple streams
* Build-in [pipeline](https://patchlevel.github.io/event-sourcing-docs/latest/pipeline/) to export, import and migrate event streams
* Versioned and managed lifecycle of [projections](https://patchlevel.github.io/event-sourcing-docs/latest/projection/)
* Smooth [upcasting](https://patchlevel.github.io/event-sourcing-docs/latest/upcasting/) of old events
* Simple setup with [scheme management](https://patchlevel.github.io/event-sourcing-docs/latest/store/) and [doctrine migration](https://patchlevel.github.io/event-sourcing-docs/latest/migration/)
* Dev [tools](https://patchlevel.github.io/event-sourcing-docs/latest/watch_server/) like realtime event watcher
* Built in [cli commands](https://patchlevel.github.io/event-sourcing-docs/latest/cli/) with [symfony](https://symfony.com/)
* and much more...

Expand Down
29 changes: 14 additions & 15 deletions docs/pages/getting_started.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,11 @@ final class GuestIsCheckedOut

## Define aggregates

Next we need to define the aggregate. So the hotel and how the hotel should behave.
We have also defined the `create`, `checkIn` and `checkOut` methods accordingly.
These events are thrown here and the state of the hotel is also changed.
Next we need to define the hotel aggregate.
How you can interact with it, which events happen and what the business rules are.
For this we create the methods `create`, `checkIn` and `checkOut`.
In these methods the business checks are made and the events are recorded.
Last but not least, we need the associated apply methods to change the state.

```php
use Patchlevel\EventSourcing\Aggregate\AggregateChanged;
Expand Down Expand Up @@ -298,10 +300,10 @@ $mailer = /* your own mailer */;
$serializer = DefaultEventSerializer::createFromPaths(['src/Domain/Hotel/Event']);
$aggregateRegistry = (new AttributeAggregateRootRegistryFactory)->create(['src/Domain/Hotel']);

$store = new DoctrineDbalStore(
$eventStore = new DoctrineDbalStore(
$connection,
$serializer,
$aggregateRegistry
$aggregateRegistry,
);

$hotelProjector = new HotelProjector($connection);
Expand All @@ -313,25 +315,22 @@ $projectorRepository = new ProjectorRepository([
$projectionStore = new DoctrineStore($connection);

$projectionist = new DefaultProjectionist(
$store,
$eventStore,
$projectionStore,
$projectorRepository
$projectorRepository,
);

$eventBus = SyncProjectionistEventBusWrapper::createWithDefaultLockStrategy(
DefaultEventBus::create([
new SyncProjectorListener($projectionist),
new SendCheckInEmailProcessor($mailer),
]),
$projectionist
$projectionist,
);

$repositoryManager = new DefaultRepositoryManager(
$aggregateRegistry,
$store,
SyncProjectionistEventBusWrapper::createWithDefaultLockStrategy(
$eventBus,
$projectionist
)
$eventStore,
$eventBus,
);

$hotelRepository = $repositoryManager->get(Hotel::class);
Expand All @@ -353,7 +352,7 @@ use Patchlevel\EventSourcing\Schema\DoctrineSchemaDirector;
$schemaDirector = new DoctrineSchemaDirector(
$connection,
new ChainSchemaConfigurator([
$store,
$eventStore,
$projectionStore
])
);
Expand Down
18 changes: 11 additions & 7 deletions docs/pages/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ A lightweight but also all-inclusive event sourcing library with a focus on deve
* Everything is included in the package for event sourcing
* Based on [doctrine dbal](https://github.com/doctrine/dbal) and their ecosystem
* Developer experience oriented and fully typed
* [Snapshots](snapshots.md) system to quickly rebuild the aggregates
* Allow to [Split-Stream](split_stream.md) for big aggregates
* [Pipeline](pipeline.md) to export,import and migrate events
* [Projectionist](projection.md) to manage versioned projections
* [Upcast](upcasting.md) old events
* [Scheme management](store.md) and [doctrine migration](migration.md) support
* Dev [tools](watch_server.md) such as a realtime event watcher
* Automatic [snapshot](snapshots.md)-system to boost your performance
* [Split](split_stream.md) big aggregates into multiple streams
* Build-in [pipeline](pipeline.md) to export, import and migrate event streams
* Versioned and managed lifecycle of [projections](projection.md)
* Smooth [upcasting](upcasting.md) of old events
* Simple setup with [scheme management](store.md) and [doctrine migration](migration.md)
* Dev [tools](watch_server.md) like realtime event watcher
* Built in [cli commands](cli.md) with [symfony](https://symfony.com/)
* and much more...

Expand All @@ -27,3 +27,7 @@ composer require patchlevel/event-sourcing

* [Symfony](https://github.com/patchlevel/event-sourcing-bundle)
* [Psalm](https://github.com/patchlevel/event-sourcing-psalm-plugin)

!!! tip

Start with the [quickstart](./getting_started.md) to get a feeling for the library.

0 comments on commit a4d782f

Please sign in to comment.