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

ActiveLibrary

linkorb/bus
===========

Command Bus component

37[1 PRs](https://github.com/linkorb/bus/pulls)PHPCI passing

Since Jan 18Pushed 3mo ago9 watchersCompare

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

READMEChangelogDependenciesVersions (2)Used By (0)

Command Bus Component
=====================

[](#command-bus-component)

This standalone component implements the Command Pattern.

It is inspired by the Laravel `illuminate/bus` and `illuminate/queue` components, but aims to be framework agnostic.

For more information about the Command Bus Pattern:

- [http://en.wikipedia.org/wiki/Command\_pattern](http://en.wikipedia.org/wiki/Command_pattern)
- [http://sourcemaking.com/design\_patterns/command](http://sourcemaking.com/design_patterns/command)

Usage
=====

[](#usage)

Any `Command` requires two classes: the `DoSomethingCommand` class and the `DoSomethingHandler` class.

You can instantiate the Command from your controllers when needed, and `dispatch` it onto the Bus.

The Bus will then resolve the matching Handler class, and ask it to handle the new Command.

Here's how you use it:

An example Command class:
-------------------------

[](#an-example-command-class)

```
