I've been busy developing a large application on Laravel. In the middle of this, I've been trying to also be a good PHP developer (oxymoron?) and look into using the Command Bus pattern, specifically using Laravel's implementation. I think I get the idea in theory: Fire a Command
, the Handler
deals with it, the Command
is immutable, and all that. I've looked up tons of tutorials on the subject, and even watched Ross Tuck's talk Models and Service Layers; Hemoglobin and Hobgoblins which mentions the subject.
The one thing these tutorials do not mention is how one might use the data generated in the Handler
. For example, say I have a controller method that fires off a command:
// Register the User
public function register(RegisterRequest $request)
{
$this->dispatch(new CreateRegistrationCommand($request));
}