PHPackages                             spekkionu/domain-dispatcher - 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. [Queues &amp; Workers](/categories/queues)
4. /
5. spekkionu/domain-dispatcher

ActiveLibrary[Queues &amp; Workers](/categories/queues)

spekkionu/domain-dispatcher
===========================

Domain command dispatcher

1.0.0(9y ago)025MITPHPPHP ~5.6|~7.0

Since Oct 19Pushed 8y ago1 watchersCompare

[ Source](https://github.com/spekkionu/domain-dispatcher)[ Packagist](https://packagist.org/packages/spekkionu/domain-dispatcher)[ Docs](https://github.com/spekkionu/domain-dispatcher)[ RSS](/packages/spekkionu-domain-dispatcher/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependencies (3)Versions (2)Used By (0)

Domain Dispatcher
=================

[](#domain-dispatcher)

[![Latest Stable Version](https://camo.githubusercontent.com/93e71cc26d95d878e856271d8334aabb4b21fb1738db9e425f908a6f2c34dc69/68747470733a2f2f706f7365722e707567782e6f72672f7370656b6b696f6e752f646f6d61696e2d646973706174636865722f762f737461626c652e706e67)](https://packagist.org/packages/spekkionu/domain-dispatcher)[![Build Status](https://camo.githubusercontent.com/bc3dd18b866e1602cb7a2b91775bb417adf48f8b62564bb68e71bc74c4a46265/68747470733a2f2f7472617669732d63692e6f72672f7370656b6b696f6e752f646f6d61696e2d646973706174636865722e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/spekkionu/domain-dispatcher)[![Code Coverage](https://camo.githubusercontent.com/80ceda4e01ae463a6623b31905b81890e574bd7089b33e47d7eabc039cd6ff29/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f7370656b6b696f6e752f646f6d61696e2d646973706174636865722f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/spekkionu/domain-dispatcher/?branch=master)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/46a406de101b9eb08fe40911b931099211501484f42d93478cb7d19796839d9b/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f7370656b6b696f6e752f646f6d61696e2d646973706174636865722f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/spekkionu/domain-dispatcher/?branch=master)[![SensioLabsInsight](https://camo.githubusercontent.com/97be6b83cb37316c140026574bbdf91c7e1e497671fafda30db2e90df5e04882/68747470733a2f2f696e73696768742e73656e73696f6c6162732e636f6d2f70726f6a656374732f61663839363765322d353233312d343364322d616162392d3238303735303731636138382f6d696e692e706e67)](https://insight.sensiolabs.com/projects/af8967e2-5231-43d2-aab9-28075071ca88)

Command dispatcher that integrates with [league/container](http://container.thephpleague.com/).

Install
-------

[](#install)

Via Composer

```
$ composer require spekkionu/domain-dispatcher
```

Usage
-----

[](#usage)

You must first register the service provider in your league/container instance.

```
$container->addServiceProvider('Spekkionu\DomainDispatcher\DispatcherServiceProvider');
```

Then you can use the dispatcher by pulling it out of the container.

```
$container = new \League\Container\Container();
$container->delegate(
    new \League\Container\ReflectionContainer
);
$dispatcher = $container->get('Spekkionu\DomainDispatcher\Dispatcher');
$command = new MyCommand($var1, $var2);
$dispatcher->dispatch($command);
```

Writing a command
-----------------

[](#writing-a-command)

```
class MyCommand
{
    /**
     * @var User
     */
    private $user;

    /**
     * You can add any arguments you need to the constructor
     */
    public function __construct(User $user)
    {
        $this->user = $user;
    }

    /**
     * The command must have a handle method.
     * Any dependencies for the handle method will be automatically resolved by the container
     * Whatever you return here will be returned by the dispatch call
     */
    public function handle(EmailSender $mailer, Logger $logger)
    {
        // Your code goes here
        $result = $mailer->sendWelcomeEmail($user);
        $logger->log('Welcome email sent to user');

        return $result;
    }
}
```

```
$user = new User();
$user->name = 'Bob';
$user->email = 'email@example.com';

$command = new MyCommand($user);
$result = $dispatcher->dispatch($command);
```

Testing
-------

[](#testing)

```
$ composer test
```

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity58

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

3492d ago

### Community

Maintainers

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

---

Top Contributors

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

---

Tags

command-dispatcherphpjobcommandbusdispatcherspekkionudomain-dispatcher

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/spekkionu-domain-dispatcher/health.svg)

```
[![Health](https://phpackages.com/badges/spekkionu-domain-dispatcher/health.svg)](https://phpackages.com/packages/spekkionu-domain-dispatcher)
```

###  Alternatives

[lorisleiva/laravel-actions

Laravel components that take care of one specific task

2.8k7.5M115](/packages/lorisleiva-laravel-actions)[imtigger/laravel-job-status

Laravel Job Status

5272.1M3](/packages/imtigger-laravel-job-status)[mxl/laravel-job

Laravel job tools

661.3M](/packages/mxl-laravel-job)[jms/job-queue-bundle

Allows to run and schedule Symfony console commands as background jobs.

3462.3M5](/packages/jms-job-queue-bundle)[qruto/laravel-flora

Install and update Laravel application with single command

13197.8k](/packages/qruto-laravel-flora)[clue/mq-react

Mini Queue, the lightweight in-memory message queue to concurrently do many (but not too many) things at once, built on top of ReactPHP

144691.7k4](/packages/clue-mq-react)

PHPackages © 2026

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