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

Sound of Symfony Podcast:
Episode 18 - Event sourcing
Jul 25, 2017 @ 12:51:49

The Sound of Symfony podcast, with hosts Magnus Nordlander and Tobias Nyholm, recently posted their latest episode - Episode #18: Event Sourcing.

In this episode we talk a little bit about Webpack Encore, and a lot about Event Sourcing, with our guest, Beau Simensen.

Other topics mentioned in this show include:

  • Beau's Domain-driven design book
  • Event sourcing libraries like EventCentric, Broadway and Prooph
  • Conferences like SymfonyLive and SymfonyCon Romania

You can listen to this latest episode either using the in-page audio player or by downloading the mp3 directly. If you enjoy the show you can subscribe to their feed and follow them on Twitter to get updates when new shows are released.

tagged: soundofsymfony podcast ep18 eventsourcing event beausimensen

Link: http://www.soundofsymfony.com/episode/episode-18/

Sam Greenwood:
Event Sourcing for the Rest of Us
Jun 27, 2017 @ 12:15:20

In this recent post to his site Sam Greenwood gives a high level overview of functionality that's becoming more popular and widely used - event sourcing. His post is a guide to event sourcing "for the rest of us" that aren't familiar with it but want to get an understanding of what it's all about.

Event sourcing can be described as storing the events that happened in your system in the order they happened, in some kind of store. These events are then replayed to recreate state in your system, rather than just having a single row in a table, using event sourcing, you have a full history of actions that happened in your system, and how your state got to the given point that it is in.

He uses a single entity in his illustration, showing how the changes would be put into an EventStore repository (possibly stored in something like this). He then sets up his event system for "members" and shows how to apply the different associated events. This is then sent to the repository for handling and saving to whatever data source you have defined.

tagged: eventsourcing introduction tutorial member event example

Link: https://www.samgreenwood.me/event-sourcing-for-the-rest-of-us/

SitePoint PHP Blog:
Event Sourcing in a Pinch
Nov 30, 2016 @ 10: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/

Loïc Faugeron:
Mars Rover, Locating moving
Oct 13, 2016 @ 09:44:59

Loïc Faugeron has posted the latest in his "Mars Rover" tutorial series to his site today. In this new post he migrates some previously created objects over into their own package to help with reporting back the rover's location.

In this series we're building the software of a Mars Rover, according to the following specifications. It allows us to practice the followings: Monolithic Repositories (MonoRepo), Command / Query Responsibility Segregation (CQRS), Event Sourcing (ES) and Test Driven Development (TDD)

We've already developed the first use case about landing the rover on mars, and the second one about driving it. We're now developing the last one, requesting its location. In this article we're going to move geolocation value objects (Location, Coordinates and Orientation) into their new package (geolocation).

He then moves over the files relating to these objects into the "Geolocation" directory and fixed the namespace to reflect the update. Tests are all still passing so he moves over to the "navigation" package and fixes a few places in the tests where these objects were mentioned (doing the same for the "orientation" handling). This finishes out the series with a complete set of classes and objects reflecting the requirements. He summarises the work that was done, how the resulting code is structured and the major role that the phpspec testing played in the whole process.

tagged: mars rover tutorial series location moving event eventsourcing commandbus phpspec

Link: https://gnugat.github.io/2016/10/12/mars-rover-locating-moving.html

Loïc Faugeron:
Mars Rover, Driving event
Sep 07, 2016 @ 10:34:18

In this latest post in the series Loïc Faugeron continues his "Mars Rover" tutorials, this time with a focus on creating the logic that will "drive" the rover around.

In this series we're building the software of a Mars Rover, according to the following specifications. It allows us to practice the followings: Monolithic Repositories (MonoRepo), Command / Query Responsibility Segregation (CQRS), Event Sourcing (ES) and Test Driven Development (TDD).

We've already developed the first use case about landing the rover on mars, and we've started the second one about driving it. [...] In this article we're going to create the actual driving logic, using Event Sourcing.

He follows the "Command Bus" design pattern and creates the command structure for the DriveRoverHandler to handle the logic related to the DriveRover instance. He starts with the spec (the test) and updates the generated class with the logic in the handle method to record an event happening on the DriveRover instance. He make a few more changes to the functionality for the spec and class to make the tests go green.

tagged: mars rover tutorial series driving event eventsourcing commandbus phpspec

Link: https://gnugat.github.io/2016/09/07/mars-rover-driving-event.html

Loïc Faugeron:
Mars Rover, Landing
Jun 30, 2016 @ 17:01:15

Loïc Faugeron has posted the latest part of his "Mars Rover" series documenting the creation of a system to control a rover following the ideas of Monolithic Repositories, Command / Query Responsibility Segregation, Event Sourcing and Test Driven Development (using phpspec). In his previous posts he set up the project and created the package for navigation. in this latest post he gets into the navigation package.

Previously we've created a navigation package, we can now start developing the first use case:

Mars Rovers need first to be landed at a given position. A position is composed of coordinates (x and y, which are both integers) and an orientation (a string being one of north, east, west or south).

He starts off with using the Command Bus pattern to create a command, a handler and a bus that acts on the commands given. True to TDD he starts with the tests and fills in the code to make it all work. This generates the skeleton class for the test which is then filled in with functionality. Running the tests again then has them all passing once a few more changes are made to the internal handling (besides just the basics).

tagged: mars rover landing tutorial monorepo cqrs eventsourcing tdd test phpspec

Link: https://gnugat.github.io/2016/06/29/mars-rover-landing.html

Loïc Faugeron:
Mars Rover, Initialization
Jun 22, 2016 @ 12:07:29

Loïc Faugeron has posted the next part of his "Mars Rover" series with the initialization of the project and taking some first steps with modules.

In this series we're going to build the software of a Mars Rover, according to the following specifications. It will allow us to practice the followings: Monolithic Repositories (MonoRepo), Command / Query Responsibility Segregation (CQRS), Event Sourcing (ES), Test Driven Development (TDD)

But first, we need to initialize our project.

He walks through the creation of the initial repository with a composer.json configuration and commits the initial version. From there he creates the "navigation" package that will handle write-only and read-only functionality to "drive" the rover around. He creates this package and a matching phpspec configuration file for testing the codebase. He then adds the navigation package to the main project though a branch merge.

tagged: marsrover kata initialization monorepo cqrs eventsourcing tdd

Link: https://gnugat.github.io/2016/06/22/mars-rover-initialization.html

Loïc Faugeron:
Mars Rover, Introduction
Jun 15, 2016 @ 10:40:44

Loïc Faugeron has started off a new series of posts with an introduction to a "Mars Rover" exercise that aims to help you refactor a "monolithic" codebase with CQRS, event sourcing and TDD practices.

In this introductory article, we're simply going to describe our Mars Rover specifications.

Note: This programming exercise originally comes from Dallas Hack Club, which is now unfortunately down. This Mars Rover kata has been adapted for the needs of this series.

He starts by outlining the goals the software will need to achieve and the complete functionality to provide. This is just the series kickoff though, so there's not much by way of code. Next in the series is the "MonoRepo" section and the setup of the actual project.

tagged: marsrover kata introduction monorepo cqrs eventsourcing tdd

Link: https://gnugat.github.io/2016/06/15/mars-rover-introduction.html