Event Sourcing in Laravel
View Slide
About meFreek Van der Herten@freekmurzespatie.befreek.devohdear.app flareapp.io
Open Source Software
spatie.be/open-source
spatie.be/videos
Let's talk aboutevent sourcing
Talk overviewTheoryProjectors demoAggregates demo
Traditional applicationWrite data in databaseAn update means overwriting the old dataThe old data cannot be accessed anymore
APPLICATIONDATABASETABLEvalue X
APPLICATIONDATABASETABLEvalue Xvalue Y
Event Sourced ApplicationThe application willfire offeventsEvents will get written in a dedicated storeEvents are passed to consumers that create projectionsAggregate, Aggregate Root...
APP EVENTSEventEvent 1
APP EVENTSEventEvent 1Event 2
APP EVENTSEventEvent 1Event 2Event 3
APPCONSUMEREVENTSPROJECTIONEventEvent 1Event 2Event 3
APPCONSUMERCONSUMER 2EVENTSPROJECTIONEventEvent 1Event 2Event 3ANOTHER PROJECTION
APPCONSUMERCONSUMER 2EVENTSPROJECTIONEventEvent 1Event 2Event 3Event 4ANOTHER PROJECTION
Event Sourced ApplicationAuditing requirementsExtra reports neededRecording the unhappy pathThere is some setup required
Laravel Event Sourcing
Laravel Event SourcingPackage made by SpatieAggregates, Projectors & ReactorsBeautifully integrated into LaravelEasy to get started with
Demo
Aggregates
Wrapping up
spatie.be/docs/laravel-event-sourcing
Packagesspatie.be/docs/laravel-event-sourcingeventsauce.io
Event sourcing makes the easy things harder……and the harder things easier— Frank De Jonge
Courseeventsourcery.com
Larabankgithub.com/spatie/larabank-traditionalgithub.com/spatie/larabank-event-projectorgithub.com/spatie/larabank-event-projector-aggregates
One more thing
spatie.be/event-sourcingThe basics of event sourcingBest practicesLaravel specific examplesEvent sourced cartETA July 2021
Thank you!spatie.be/docs/laravel-event-sourcingspatie.be/products (only this week 25 % discount on everything)ohdear.app