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

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

pauci/cqrs
==========

CQRS library

v0.7.1(1y ago)1725.2k5[4 issues](https://github.com/pauci/cqrs/issues)3MITPHPPHP ^8.1 || ^8.2CI failing

Since Mar 2Pushed 1y ago3 watchersCompare

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

READMEChangelog (10)Dependencies (12)Versions (32)Used By (3)

CQRS library
============

[](#cqrs-library)

[![Source Code](https://camo.githubusercontent.com/d01b0ee4a55ff11e566b13704a966f13e124ad4151178fe8a3b9052c20f57c3f/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f736f757263652d70617563692f637172732d626c75652e7376673f7374796c653d666c61742d737175617265)](https://github.com/pauci/cqrs)[![PHP](https://camo.githubusercontent.com/86853b6c6423ce45e71409546d61d5c02802fc32067d23c42236d1e96a073696/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f70617563692f637172733f7374796c653d666c61742d737175617265)](https://php.net)[![Latest Version](https://camo.githubusercontent.com/fb7e69edf56e4b6a26376cb020c7bbae37c2fef348a92095789b103826445967/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f70617563692f637172732e7376673f7374796c653d666c61742d737175617265266c6162656c3d72656c65617365)](https://packagist.org/packages/pauci/cqrs)[![Build Status](https://camo.githubusercontent.com/27e593b9f77e6c05f4d3c920e84e4b2ee1e2c9a2831ced89057e1bf0695acc45/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f70617563692f637172732f436f6e74696e756f7573253230496e746567726174696f6e3f7374796c653d666c61742d737175617265)](https://github.com/pauci/cqrs/actions?query=workflow%3A%22Continuous+Integration%22)[![Coverage Status](https://camo.githubusercontent.com/ca21d615075d7f0611a03780bbb12f7f1a5ec8f5b6a54fb55e8a151c9bd2e20c/68747470733a2f2f696d672e736869656c64732e696f2f636f6465636f762f632f6769746875622f70617563692f637172733f7374796c653d666c61742d73717561726526746f6b656e3d5a433435545037485158)](https://codecov.io/gh/pauci/cqrs)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](https://github.com/pauci/cqrs/blob/master/LICENSE)[![Total Downloads](https://camo.githubusercontent.com/4ac1c7e9080b8e37cb1f034820ece37cebb3edd8a369b2a5563c25cf853b169f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f70617563692f637172732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/pauci/cqrs)

Installation &amp; Requirements
-------------------------------

[](#installation--requirements)

The core library has no dependencies on other libraries. Plugins have dependencies on their specific libraries.

Install with [composer](http://getcomposer.org):

```
composer require pauci/cqrs
```

Usage
-----

[](#usage)

```
final class User extends \CQRS\Domain\Model\AbstractEventSourcedAggregateRoot
{
    private int $id;
    private string $name;

    public static function create(int $id, string $name): self
    {
        $user = new self($id);
        $user->apply(new UserCreated($name));
        return $user;
    }

    private function __construct(int $id)
    {
        $this->id = $id;
    }

    protected function applyUserCreated(UserCreated $event): void
    {
        $this->name = $event->getName();
    }

    public function getId(): int
    {
        return $this->id;
    }

    public function changeName(string $name): void
    {
        if ($name !== $this->name) {
            $this->apply(new UserNameChanged($name));
        }
    }

    protected function applyUserNameChanged(UserNameChanged $event): void
    {
        $this->name = $event->getName();
    }
}

final class UserCreated
{
    private string $name;

    public function __construct(string $name)
    {
        $this->name = $name;
    }

    public function getName(): string
    {
        return $this->name;
    }
}

final class ChangeUserName
{
    public int $id;
    public string $name;
}

final class UserNameChanged
{
    private string $name;

    public function __construct(string $name)
    {
        $this->name = $name;
    }

    public function getName(): string
    {
        return $this->name;
    }
}

class UserService
{
    protected $repository;

    public function __construct($repository)
    {
        $this->repository = $repository;
    }

    public function changeUserName(ChangeUserName $command): void
    {
        $user = $this->repository->find($command->id);
        $user->changeName($command->name);
    }
}

class EchoEventListener
{
    public function onUserNameChanged(
        UserNameChanged $event,
        \CQRS\Domain\Message\Metadata $metadata,
        \DateTimeInterface $timestamp,
        int $sequenceNumber,
        int $userId
    ): void {
        echo "Name of user #{$userId} changed to {$event->getName()}.\n";
    }
}

$command = new ChangeUserName([
    'id' => 1,
    'name' => 'Jozko Mrkvicka',
]);
$commandBus->dispatch($command);
```

###  Health Score

43

—

FairBetter than 89% of packages

Maintenance27

Infrequent updates — may be unmaintained

Popularity33

Limited adoption so far

Community19

Small or concentrated contributor base

Maturity77

Established project with proven stability

 Bus Factor1

Top contributor holds 95.2% 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

Every ~128 days

Recently: every ~239 days

Total

25

Last Release

697d ago

PHP version history (8 changes)0.1.0PHP ^5.6 || ^7.0

v0.3.0PHP ^7.0

v0.4.0PHP ^7.1

v0.5.0PHP ^7.4

v0.5.2PHP ^7.4 | ^8.0

v0.6.0PHP ~8.0.0||~8.1.0

v0.7.0PHP ^8.0 || ^8.1 || ^8.2

v0.7.1PHP ^8.1 || ^8.2

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/2421146?v=4)[Pavol Kirschbaum](/maintainers/pauci)[@pauci](https://github.com/pauci)

---

Top Contributors

[![pauci](https://avatars.githubusercontent.com/u/2421146?v=4)](https://github.com/pauci "pauci (258 commits)")[![lukasblaho](https://avatars.githubusercontent.com/u/8330355?v=4)](https://github.com/lukasblaho "lukasblaho (11 commits)")[![newPOPE](https://avatars.githubusercontent.com/u/484382?v=4)](https://github.com/newPOPE "newPOPE (2 commits)")

---

Tags

dddevent sourcingcqrspauci

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

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

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

###  Alternatives

[ecotone/ecotone

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

564576.7k53](/packages/ecotone-ecotone)[symfony/symfony

The Symfony PHP framework

31.4k87.2M2.2k](/packages/symfony-symfony)[laravel/framework

The Laravel Framework.

34.8k543.8M20.1k](/packages/laravel-framework)[patchlevel/event-sourcing

A lightweight but also all-inclusive event sourcing library with a focus on developer experience

207362.9k13](/packages/patchlevel-event-sourcing)[tempest/framework

The PHP framework that gets out of your way.

2.2k34.4k15](/packages/tempest-framework)[oat-sa/generis

TAO generis library

10148.8k125](/packages/oat-sa-generis)

PHPackages © 2026

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