1. Go to this page and download the library: Download fhteam/xenforo-amqp 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/ */
fhteam / xenforo-amqp example snippets
//============ AMQP connector settings ============
$config['amqp'] = array(
'host' => '192.168.1.1.1', // The host where your AMPQ-compatible server runs
'port' => '5672', // Port, your server runs on
'user' => 'user', // Authentication user name
'password' => 'password', // Authentication password
'queues' => array( // Queues configuration
'auth_ban' => array( // The name of the queue
'queue_flags' => array( // Queue flags.
'durable' => true, // 'durable' means the queue will survice server reboot
),
),
),
);
$manager = new \Forumhouse\XenForoAmqp\QueueManager();
$manager->pushMessage(
'my_queue_name', // The name of the queue. Must be in configuration file (see above)
array('data' => 'test_data'), // The data to send to the queue. Will be json_encode'd if array is provided
array('delivery_mode' => 2) // Message properties. 'delivery_mode' => 2 makes message persistent
);