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

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

minhlhst/command-bus
====================

Simple Command Bus for Laravel framework from ST team

1.0.0(2y ago)06MITPHPPHP ^8.1

Since Oct 30Pushed 2y ago1 watchersCompare

[ Source](https://github.com/LeHongMinh-ST/laravel-command-bus)[ Packagist](https://packagist.org/packages/minhlhst/command-bus)[ RSS](/packages/minhlhst-command-bus/feed)WikiDiscussions master Synced 1mo ago

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

Command Bus
===========

[](#command-bus)

> ST team Simple Command Bus for Laravel framework

Installation
------------

[](#installation)

```
composer require minhlhst/command-bus

```

If your Laravel version is less than 5.5, add the following line to the providers array in `config / app.php`:

```
MinhlhSt\CommandBus\CommandBusServiceProvider::class,
```

Example
-------

[](#example)

```
class UserController extends Controller
{
    public function store(Request $request)
    {
        $user = $this->dispatch(new RegisterUserCommand(
            $request->input('email'),
            $request->input('password')
        ));

        return $user;
    }
}
```

Usage
-----

[](#usage)

#### Command

[](#command)

```
use MinhlhSt\CommandBus\Command;

class RegisterUserCommand implements Command
{
     public function __construct(
        private string $name,
        private string $password
    )
    {
    }

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

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

    public function setName(string $name): void
    {
        $this->name = $name;
    }

    public function setPassword(string $password): void
    {
        $this->password = $password;
    }
}
```

#### Handler

[](#handler)

```
use MinhlhSt\CommandBus\Handler;
use MinhlhSt\CommandBus\Command;

class RegisterUserHandler implements Handler
{
    private $userRepository;

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

    public function handle(Command $command): User
    {
        $user = new User(
            $command->email(),
            $command->password()
        );

        $this->userRepository->store($user);

        return $user;
    }
}
```

#### Controllers

[](#controllers)

```
use MinhlhSt\CommandBus\AbsctractController;
use MinhlhSt\CommandBus\CommandBus;
use MinhlhSt\CommandBus\Command;

class Controller extends AbsctractController
{
    private $dispatcher;

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

    public function dispatch(Command $command)
    {
        return $this->dispatcher->execute($command);
    }
}
```

```
class UserController extends Controller
{
    public function store(Request $request)
    {
        $user = $this->dispatch(new RegisterUserCommand(
            $request->input('email'),
            $request->input('password')
        ));

        return $user;
    }
}
```

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity51

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

930d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/be806d2eb0c5c799e383120420a3efd74b9df4c5175b03c1dbccae847fdff608?d=identicon)[LeHongMinh-ST](/maintainers/LeHongMinh-ST)

---

Top Contributors

[![hapo-minhlh](https://avatars.githubusercontent.com/u/133086933?v=4)](https://github.com/hapo-minhlh "hapo-minhlh (3 commits)")

### Embed Badge

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

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

###  Alternatives

[illuminate/events

The Illuminate Events package.

13454.3M1.8k](/packages/illuminate-events)[psalm/plugin-laravel

Psalm plugin for Laravel

3274.9M308](/packages/psalm-plugin-laravel)[watson/active

Laravel helper for recognising the current route, controller and action

3253.6M14](/packages/watson-active)[illuminate/broadcasting

The Illuminate Broadcasting package.

7126.5M178](/packages/illuminate-broadcasting)[flarum/core

Delightfully simple forum software.

211.3M1.9k](/packages/flarum-core)[dragon-code/pretty-routes

Pretty Routes for Laravel

10058.7k4](/packages/dragon-code-pretty-routes)

PHPackages © 2026

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