PHP Event Sourcing Snapshoting
In general having streams in need for snapshots may indicate that our model needs revisiting. We may cut the stream on some specific event and begin new one, like at the end of month from all the transactions we generate invoice and we start new stream for next month. However if cutting the stream off is not an option for any reason, we snapshot aggregate state at given point of time, so we can skip previous events. This process continues on predefined threshold, like every 1000 events.
public function aggregateSnapshots()
$snapshotGivenAggregates = [Ticket::class, Basket::class];
$threshold = 1000;