PHP code example of centraldesktop / stomp

1. Go to this page and download the library: Download centraldesktop/stomp 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/ */

    

centraldesktop / stomp example snippets


  use CentralDesktop\Stomp\Connection;
  $factory = new \CentralDesktop\Stomp\ConnectionFactory\Failover(['host1:61612','host2:61612']), true);
  $con = new Connection($factory);
  
  // connect with some bad credentials and stomp protocol 1.2 (default 1.0 currently)
  $con->connect('username','password',1.2);
  
  // send a message to the "test" queue with body of payload
  // and with the message attribute persistent:true
  $con->send("test", "payload", array("persistent" => 'true'));