2017 © Pedro Peláez
 

library xenforo-amqp

AMQP library for using in XenForo addons

image

fhteam/xenforo-amqp

AMQP library for using in XenForo addons

  • Wednesday, March 4, 2015
  • by FractalizeR
  • Repository
  • 4 Watchers
  • 0 Stars
  • 4 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

xenforo-amqp

AMQP client library for XenForo to use servers like RabbitMQ from XenForo, (*1)

Installation

Please do note, that package name has changed to fhteam/xenforo-amqp. Old name should still work though it will no longer be maintained., (*2)

Library follows PSR4 so installation is a bit different from what we can see in all XenForo addons, (*3)

So, to use this library you can directly include the script into your source or do the following:, (*4)

  • Install composer into your system or into XenForo root: https://getcomposer.org/doc/00-intro.md#installation-linux-unix-osx
  • Run composer init in your XenForo root to create composer.json: https://getcomposer.org/doc/03-cli.md#init
  • Run composer require --update-no-dev fhteam/xenforo-amqp:dev-master to install this package (--update-no-dev skips packages added for syntax highlighting ony like Zend Framework): https://getcomposer.org/doc/03-cli.md#require
  • Put a line require_once(__DIR__ . '/../vendor/autoload.php'); into your library/config.php to add composer autoloader into XenForo's autoloading chain
  • Now you can use all composer packages (together with ours) in your development process and easily manage them using composer executable

Configuration

Put the following lines at the end of your library/config.php:, (*5)

//============ 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
            ), 
        ),
    ),
);

Usage:

  • Create manager instance:
$manager = new \Forumhouse\XenForoAmqp\QueueManager();
  • Push a message to queue:
$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
);

The Versions

04/03 2015

dev-master

9999999-dev

AMQP library for using in XenForo addons

  Sources   Download

GPL-2.0

The Requires

 

The Development Requires

04/03 2015

v1.0.0

1.0.0.0

AMQP library for using in XenForo addons

  Sources   Download

GPL-2.0

The Requires

 

The Development Requires