Skip to content

Command Query Responsibility Segregation is a simple concept. When you want something to happen, you will use a Command. If you need results returned, you will use a query.

An over simplified example of this would be if you need to write to a database, you would use a Command. If you need results from a database, you would use a Query.

Installation

composer require sonsofphp/cqrs

Symfony Bridge

Installing the Symfony Bridge will add additional functionality to the CQRS component. This can be done quickly and easily. The documentation will point out where this is required.

composer require sonsofphp/cqrs-symfony

Tip

This component pairs well with the sonsofphp/event-sourcing component.

composer require sonsofphp/event-sourcing