Command Query Responsibility Segregation (CQRS) with Domain Driven Design is more and more popular recently. Its implementation in PHP, which will be the topic of the article, generates some new possibilities, making a process more efficient. For example, it gives you the opportunity to restore the whole system easily. By Michał Żądło.
Before I step to the CQRS and Event Sourcing implementation in PHP - I’ll try to briefly explain what is the general concept behind CQRS. In 1986, Bertrand Meyer came up with an idea of Command Query Separation (CQS). According to the concept - each method in the object in its current state must belong to only one category out of the following two: command - a method which changes an object’s state, query - a method which returns the data.
The article deals with:
- Using Command Query Responsibility Segregation (CQRS pattern)
- What is Event Sourcing and Event Store?
- Pros and cons of Event Sourcing
- What is Broadway and what components it gives us?
- Write Model implementation
- Read Model implementation
- The change in requirements
- Snapshots
- CQRS and event sourcing - summary
… and more. Author advises you to invest some time and try this solution to decide whether or not it’s useful for you. You should also brush up on related topics such as event log, domain model, data store, event driven architecture, event processing or temporal queries. Excellent read full of in depth details about event sourcing with links to further reading!
[Read More]