Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

SitePoint PHP Blog:
Event Sourcing in a Pinch
Nov 30, 2016 @ 16:56:26

Christopher Pitt is back with a new tutorial on the SitePoint PHP blog talking about event sourcing in PHP including a brief explanation about what it is and how it can be useful in your PHP application.

Let’s talk about Event Sourcing. Perhaps you’ve heard of it, but haven’t found the time to attend a conference talk or read one of the older, larger books which describe it. It’s one of those topics I wish I’d known about sooner, and today I’m going to describe it to you in a way that I understand it.

Christopher then gets into some of the basic concepts behind event sourcing, a part of Domain Driven Design, and the difference between storing state and storing behavior. With this outlined he gets into the creation of the actual event handlers with examples from a retail application (orders, outlets, stock, pricing, etc). He includes the code for several simple events, a method for recoding them in your database and some helper functions to translate the event to the SQL required for the insert operation. He then links these with the event classes and putting them to use, executing them and getting the results back via a sort of "layer" between the fetch and the response.

tagged: eventsourcing tutorial introduction example domaindrivendesign

Link: https://www.sitepoint.com/event-sourcing-in-a-pinch/


Trending Topics: