1. Go to this page and download the library: Download communitales/status-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/ */
communitales / status-bus example snippets
use Communitales\Component\StatusBus\StatusBusInterface;
use Communitales\Component\StatusBus\StatusMessage;
final readonly class CreateOrder
{
public function __construct(private StatusBusInterface $statusBus)
{
}
public function __invoke(string $orderNumber): void
{
// Application code ...
$this->statusBus->publish(StatusMessage::success(
message: 'order.created',
parameters: ['%order%' => $orderNumber],
domain: 'status',
context: ['order_number' => $orderNumber],
));
}
}
use Communitales\Component\StatusBus\Failure\RethrowDeliveryFailureHandler;
use Communitales\Component\StatusBus\StatusBus;
$statusBus = new StatusBus($handlers, new RethrowDeliveryFailureHandler());
use Communitales\Component\StatusBus\Handler\StatusHandlerInterface;
use Communitales\Component\StatusBus\StatusMessage;
final class CustomStatusHandler implements StatusHandlerInterface
{
public function handle(StatusMessage $message): void
{
// Deliver the message to another destination.
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.