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

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

thomasderooij/laravel-cqrs
==========================

A laravel CQRS class setup.

1.0.0(3y ago)027MITPHPPHP ^8.1

Since Oct 18Pushed 3y ago1 watchersCompare

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

READMEChangelog (1)Dependencies (3)Versions (2)Used By (0)

Laravel Cqrs
------------

[](#laravel-cqrs)

Install
-------

[](#install)

Require this package with composer using the following command:

```
composer require thomasderooij/laravel-cqrs
```

The package will automaticall register the required service providers.

Optionally, publish the packages config by running

```
php artisan vendor:publish --provider="Thomasderooij\LaravelCqrs\Providers\CqrsServiceProvider"
```

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.

Commands
--------

[](#commands)

```
php artisan cqrs:command
```

This will create a command for you. Per default this will be in the app/Cqrs/Commands directory.

```
php artisan cqrs:query
```

This will create a command for you. Per default this will be in the app/Cqrs/Queries directory.

Configuration
-------------

[](#configuration)

To change the directory in which you want to create your command and queries, simply publish the assets of the CqrsServiceProvider and add your custom directory in config/cqrs.php

###  Health Score

25

—

LowBetter than 35% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity55

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

1356d 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 (12 commits)")

---

Tags

laravelcqrs

### Embed Badge

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

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

###  Alternatives

[grumpydictator/firefly-iii

Firefly III: a personal finances manager.

23.9k69.5k](/packages/grumpydictator-firefly-iii)[firefly-iii/data-importer

Firefly III Data Import Tool.

8035.8k](/packages/firefly-iii-data-importer)[markwalet/nova-modal-response

A Laravel Nova asset for Modal responses on an action.

17878.9k](/packages/markwalet-nova-modal-response)[ecotone/laravel

Ecotone for Laravel — CQRS, Event Sourcing, Sagas, Durable Workflows, and Outbox on top of Laravel Queue, via PHP attributes.

21318.6k3](/packages/ecotone-laravel)[ronasit/laravel-helpers

Provided helpers function and some helper class.

2085.6k31](/packages/ronasit-laravel-helpers)[team-nifty-gmbh/tall-datatables

Server-side rendered datatables for Laravel and Livewire

1320.9k4](/packages/team-nifty-gmbh-tall-datatables)

PHPackages © 2026

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