PHPackages                             esoul-cz/cqrs - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. esoul-cz/cqrs

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

esoul-cz/cqrs
=============

Simple CQRS implementation.

v1.0.1(1mo ago)017↓100%1gpl-2.0-or-laterPHPPHP &gt;=8.5

Since Apr 27Pushed 1mo agoCompare

[ Source](https://github.com/eSoul-cz/cqrs)[ Packagist](https://packagist.org/packages/esoul-cz/cqrs)[ RSS](/packages/esoul-cz-cqrs/feed)WikiDiscussions master Synced 1w ago

READMEChangelogDependencies (3)Versions (3)Used By (1)

esoul-cz/cqrs
=============

[](#esoul-czcqrs)

Minimal CQRS library for PHP 8.5+ with:

- `CommandBus` for write operations
- `QueryBus` for read operations
- attribute-based handler discovery
- optional discovery result caching
- pluggable handler instantiation through `HandlerFactoryInterface`

The package stays small on purpose. It does not ship with a container integration, middleware pipeline, or framework bindings.

Requirements
------------

[](#requirements)

- PHP `>=8.5`

Installation
------------

[](#installation)

Install from Packagist:

```
composer require esoul-cz/cqrs
```

If you need to install directly from GitHub instead, add the repository to `composer.json`:

```
{
  "repositories": [
    {
      "type": "vcs",
      "url": "https://github.com/eSoul-cz/cqrs"
    }
  ]
}
```

Concepts
--------

[](#concepts)

Commands and queries are marker interfaces with phpdoc generics:

- `CommandInterface`
- `QueryInterface`

Handlers implement:

- `CommandHandlerInterface`
- `QueryHandlerInterface`

Each handler exposes a single `handle()` method that receives the corresponding command or query and returns the result.

Quick Start
-----------

[](#quick-start)

### Define a command

[](#define-a-command)

```
