PHPackages                             upgate/laravel-command-bus - 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. upgate/laravel-command-bus

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

upgate/laravel-command-bus
==========================

Laravel Command Bus

0.2.1(6y ago)118BSD-2-ClausePHPPHP &gt;=7.2CI failing

Since Oct 1Pushed 6y ago2 watchersCompare

[ Source](https://github.com/upgate/laravel-command-bus)[ Packagist](https://packagist.org/packages/upgate/laravel-command-bus)[ RSS](/packages/upgate-laravel-command-bus/feed)WikiDiscussions master Synced 2w ago

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

Simple Command Bus for Laravel 5+
=================================

[](#simple-command-bus-for-laravel-5)

[![Build Status](https://camo.githubusercontent.com/d55f7850cbee61884b580b4c85c4208ef492792899f5f681d007726139365d72/68747470733a2f2f7472617669732d63692e6f72672f7570676174652f6c61726176656c2d636f6d6d616e642d6275732e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/upgate/laravel-command-bus)

Setup
-----

[](#setup)

1. `composer require upgate/laravel-command-bus`
2. Register `Upgate\LaravelCommandBus\CommandBusServiceProvider` as a service provider
3. In your service provider, bind `Upgate\LaravelCommandBus\HandlerResolver` to an implementation of your choice.

HandlerResolver binding examples:

a) `PatternHandlerResolver`:

```
$this->app->singleton(
    \Upgate\LaravelCommandBus\HandlerResolver::class,
    function () {
        return new \Upgate\LaravelCommandBus\PatternHandlerResolver(
            '\YourAppNamespace\CommandHandlers\%sHandler'
        );
    }
);
```

b) `MapHandlerResolver`:

```
use YourAppNamespace\Commands;
use YourAppNamespace\CommandHandlers;
// ...
$this->app->singleton(
    \Upgate\LaravelCommandBus\HandlerResolver::class,
    function () {
        return new \Upgate\LaravelCommandBus\MapHandlerResolver(
            [
                Commands\FooCommand::class => Handlers\FooHandler::class,
                Commands\BarCommand::class => Handlers\BarHandler::class,
                // ...
            ]
        );
    }
);
```

c) Bind your own implementation (must extend `\Upgate\LaravelCommandBus\HandlerResolver`).

Usage
-----

[](#usage)

Simplified example:

```
// Command
class SignUpCommand {

    public function __construct($email, $password)
    {
        $this->email = $email;
        $this->password = $password;
    }

    public function email()
    {
        return $this->email;
    }

    public function password()
    {
        return $this->password;
    }
}

// Handler
class SignUpHandler {

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

    public function handle(SignUpCommand $command)
    {
        $user = User::signUp($command->email(), $command->password());
        $this->userRepository->store($user);
    }

}

// HTTP Controller
use Upgate\LaravelCommandBus\CommandBus;

class UserController {

    private $commandBus;

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

    public function signUp(Request $request)
    {
        $this->commandBus->execute(new SignUpCommand(
            $request->get('email'),
            $request->get('password')
        ));
    }

}

// Console command
use Upgate\LaravelCommandBus\CommandBus;

class SignUpUserConsoleCommand
{

    private $commandBus;

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

    public function handle()
    {
        $this->commandBus->execute(new SignUpCommand(
            $this->argument('email'),
            $this->argument('password')
        ));
    }

}
```

Of course, you might (and should) want to introduce Controller and ConsoleCommand abstract classes with `executeCommand()` methods implemented.

###  Health Score

24

—

LowBetter than 30% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity50

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

Every ~525 days

Total

3

Last Release

2190d ago

PHP version history (2 changes)0.1.0PHP &gt;=7.0

0.2.0PHP &gt;=7.2

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/7947177?v=4)[Konstantin Baryshnikov](/maintainers/kbaryshnikov)[@kbaryshnikov](https://github.com/kbaryshnikov)

---

Top Contributors

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

---

Tags

laravelcommand bus

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/upgate-laravel-command-bus/health.svg)

```
[![Health](https://phpackages.com/badges/upgate-laravel-command-bus/health.svg)](https://phpackages.com/packages/upgate-laravel-command-bus)
```

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3345.4M354](/packages/psalm-plugin-laravel)[laravel/ai

The official AI SDK for Laravel.

1.1k4.6M306](/packages/laravel-ai)[moonshine/moonshine

Laravel administration panel

1.3k268.2k88](/packages/moonshine-moonshine)[illuminate/pipeline

The Illuminate Pipeline package.

9350.2M309](/packages/illuminate-pipeline)[nativephp/mobile

NativePHP for Mobile

1.1k102.1k138](/packages/nativephp-mobile)[api-platform/laravel

API Platform support for Laravel

58190.1k21](/packages/api-platform-laravel)

PHPackages © 2026

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