PHPackages                             thomasderooij/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. thomasderooij/cqrs

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

thomasderooij/cqrs
==================

A basic CQRS class setup.

1.0.0(3y ago)0281MITPHPPHP ^8

Since Oct 18Pushed 3y ago1 watchersCompare

[ Source](https://github.com/thomasderooij/cqrs)[ Packagist](https://packagist.org/packages/thomasderooij/cqrs)[ RSS](/packages/thomasderooij-cqrs/feed)WikiDiscussions master Synced today

READMEChangelog (1)DependenciesVersions (2)Used By (1)

Cqrs
----

[](#cqrs)

Install
-------

[](#install)

Require this package with composer using the following command:

```
composer require thomasderooij/cqrs
```

Docs
----

[](#docs)

It's a set of classes to create a clear distinction between commands, or things that write and do stuff, and queries, things that fetch you information.

The setup is simple. Create a command or query. Your constructor should receive the data is needs to complete its task. Any dependencies should also be instantiated here. I personally use singletons, but implement is however you like.

Your commands and queries have 3 protected functions;

- Run (your actual code)
- isSatisfied (a function that should check whether you can execute the code)
- Exception (the exception that will be thrown if isSatisfied returns false)

The traits canCommand and canQuery set up a class to run your commands and queries.

Quick example: You have a command called StoreFileCommand. It takes a file location from your request as a constructor argument.

- The run function actually moves it to a dedicated directory, and makes a database entry so you can get your file later on.
- The isSatisfied function checks the file extension, size and other limitations you might want to put on your files.
- The Exception function returns a new FileTooBig exception to throw when the file is too big.

Your controller says $this-&gt;execute(new StoreFileCommand($fileLocation, $targetLocation)); and bam. File is stored. Clean, reusable. Lovely.

This is a basic package without any implementation of database transactions. As such, it will throw exceptions when you don't create your own implementation of the Transactions trait. So yea, this is not an out-of-the-box thing. Good luck and have fun.

###  Health Score

23

—

LowBetter than 26% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity47

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

1354d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/d102fcc2d59ab09d4175f9904c6ade3e66d937b00ecaf50d998f075a30f22e47?d=identicon)[thomasderooij](/maintainers/thomasderooij)

---

Top Contributors

[![thomasderooij](https://avatars.githubusercontent.com/u/4620946?v=4)](https://github.com/thomasderooij "thomasderooij (4 commits)")

---

Tags

cqrs

### Embed Badge

![Health badge](/badges/thomasderooij-cqrs/health.svg)

```
[![Health](https://phpackages.com/badges/thomasderooij-cqrs/health.svg)](https://phpackages.com/packages/thomasderooij-cqrs)
```

###  Alternatives

[prooph/service-bus

PHP Enterprise Service Bus Implementation supporting CQRS and DDD

4451.4M32](/packages/prooph-service-bus)[ecotone/ecotone

Enterprise architecture layer for Laravel and Symfony — CQRS, Event Sourcing, Durable Workflows (Sagas, Orchestrators), Projections, and Outbox messaging via PHP attributes.

564576.7k51](/packages/ecotone-ecotone)[prooph/event-store-bus-bridge

Marry CQRS with Event Sourcing

37526.2k15](/packages/prooph-event-store-bus-bridge)[smoothphp/querybus

A simple bus for queries

1085.2k](/packages/smoothphp-querybus)[dykyi-roman/awesome-claude-code

Claude Code extension for PHP: audits (architecture, DDD, security, performance, PSR, design patterns, Docker, CI/CD, tests, docs), 3-level code review, automated bug fix, generators (DDD, CQRS, GoF patterns, PSR, tests, documentation, Docker, CI/CD), code explanation, refactoring. 26 commands, 62 agents, 259 skills.

851.2k](/packages/dykyi-roman-awesome-claude-code)[pauci/cqrs

CQRS library

1725.2k3](/packages/pauci-cqrs)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
