1. Go to this page and download the library: Download icanboogie/bind-message-bus library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
icanboogie / bind-message-bus example snippets
use ICanBoogie\MessageBus\SimpleDispatcher;
/* @var \ICanBoogie\Application $app */
$bus = new SimpleDispatcher($app->message_handler_provider);
# or
$bus = $app->message_bus;
use ICanBoogie\Routing\Controller;
class ProductController extends Controller
{
use Controller\ActionTrait;
use \ICanBoogie\Binding\MessageBus\ControllerBindings;
protected function action_create()
{
$message = new CreateProduct($this->request['payload']);
$result = $this->dispatch_message($message);
return $this->respond($result);
}
}
namespace App\Application\Message;
use function ICanBoogie\Service\ref;
use ICanBoogie\Binding\MessageBus\MessageBusConfig;
return [
MessageBusConfig::HANDLERS => [
CreateArticle::class => ref('handler.article.create'),
DeleteArticle::class => ref('handler.article.delete'),
]
];
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.