2017 © Pedro Peláez
 

library php-amqpbus

This library is an implementation of the AMQP Consumer / Publisher wrappers for php-amqplib. It's been tested against RabbitMQ.

image

evgmel/php-amqpbus

This library is an implementation of the AMQP Consumer / Publisher wrappers for php-amqplib. It's been tested against RabbitMQ.

  • Monday, May 22, 2017
  • by evgmel
  • Repository
  • 0 Watchers
  • 0 Stars
  • 2 Installations
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

php-amqpbus

This library is a wrapper for php-amqplib., (*1)

You can use Consumer and Publisher/Producer in your projects to process messages from RabbitMQ by AMQP., (*2)

Supported RabbitMQ Version

This library uses AMQP 0.9.1 by default and thus requires [RabbitMQ 2.0 or later version] (http://www.rabbitmq.com/download.html)., (*3)

Setup

Add install via composer:, (*4)

$ composer.phar require "evgmel/php-amqpbus:dev-master"

Publisher and Consumer Usage Example

Before using these examples you should setup RebbitMQ and need to know settings parameters to create instances of consumer and producer., (*5)

Usage in Silex application:


// publisher.php file <?php use Bus\AMQP\Publisher\MessagePublisherInterface; require_once __DIR__ . '/../vendor/autoload.php'; /** @var \Silex\Application $app */ $app = require_once(__DIR__ . '/../app/config/bootstrap/app.php'); require_once(__DIR__ . '/../app/config/conf_dev.php'); $app->boot(); /** @var MessagePublisherInterface $publisher */ $publisher = $app['app.bus.amqp.publisher']; $eventName = $argv[1] ?? 'not_specified_event_name'; $data = isset($argv[2]) ? [$argv[2]] : ['defaultDataKey' => 'defaultDataValue']; $publisher->publish($eventName, $data);

Run this command:, (*6)

    php7.1 publisher.php myEventNameHere MyMessageTextHere

After previous command a message with name 'myEventNameHere' will be published to the queue;, (*7)

 // consumer.php file

 <?php
use Bus\AMQP\Consumer\MessageConsumerInterface;
require_once __DIR__ . '/../vendor/autoload.php';
/** @var \Silex\Application $app */
$app = require_once(__DIR__ . '/../app/config/bootstrap/app.php');
require_once(__DIR__ . '/../app/config/conf_dev.php');
$app->boot();
/** @var MessageConsumerInterface $consumer */
$consumer = $app['app.bus.amqp.consumer'];

register_shutdown_function([$consumer, 'handleError']);

$consumer->consume();

Run this command:, (*8)

    php7.1 consumer.php 

Consumer will process incoming messages from a queue., (*9)

The Versions

22/05 2017

dev-master

9999999-dev https://bitbucket.org/evgmel/php-amqpbus

This library is an implementation of the AMQP Consumer / Publisher wrappers for php-amqplib. It's been tested against RabbitMQ.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Evgeny Melnikov

rabbitmq queue message consumer publisher

22/05 2017

1.1.2.x-dev

1.1.2.9999999-dev https://bitbucket.org/evgmel/php-amqpbus

This library is an implementation of the AMQP Consumer / Publisher wrappers for php-amqplib. It's been tested against RabbitMQ.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Evgeny Melnikov

rabbitmq queue message consumer publisher

22/05 2017

v1.1.2

1.1.2.0 https://bitbucket.org/evgmel/php-amqpbus

This library is an implementation of the AMQP Consumer / Publisher wrappers for php-amqplib. It's been tested against RabbitMQ.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Evgeny Melnikov

rabbitmq queue message consumer publisher