Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Matthias Noback:
A wave of command buses
Jan 07, 2015 @ 16:01:18

In his latest post Matthias Noback looks at the recent interest in command bus handling in the PHP community. He introduces the concept for those not familiar with it and how it's handled in most of the command libraries.

Recently many people in the PHP community have been discussing a thing called the "command bus". The Laravel framework nowadays contains an implementation of a command bus and people have been talking about it in several vodcasts. [...] Since I consider this topic to be a very important and highly relevant one, I will spend several blog posts on it, explaining the concepts in my own terms, then introducing SimpleBus as a ready-made solution for your everyday PHP projects.

He starts with the definition of a command as something used "separate the technical aspects of user input from their meaning inside the application", a request from the client for the application to perform a task. He gives a simple example of a command (SignUp) and how it would be sent to the bus for handling. He lists some of the advantages of using commands like this, including the separation it allows between things like controllers and the actual functionality. He finishes up the post with a look at the actual command handler (with sample code) and the one-to-one relationship they have with the actual command.

Using commands you can separate the web-specific parts of your application from its essence. Commands define the use cases of your application and provide an internal API for anyone that might want to do something with your application.
tagged: commandbus command introduction simplebus tutorial

Link: http://php-and-symfony.matthiasnoback.nl/2015/01/a-wave-of-command-buses/


Trending Topics: