PHP code example of stream-lib / rabbitmq-super-stream

1. Go to this page and download the library: Download stream-lib/rabbitmq-super-stream 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/ */

    

stream-lib / rabbitmq-super-stream example snippets


use StreamLib\RabbitMqSuperStream\SuperStreamClient;

$client = new SuperStreamClient([
    'host' => 'rabbitmq',
    'port' => 5552,
    'username' => 'guest',
    'password' => 'guest',
    'vhost' => '/',
    'super_stream' => 'orders',
]);

$result = $client->publish(
    body: json_encode(['order_id' => 123], JSON_THROW_ON_ERROR),
    routingKey: 'customer-123',
    messageId: 'msg-123',
    contentType: 'application/json',
);
bash
php examples/plain-php.php