Skip to content

rouliane/amqp

 
 

Repository files navigation

Puzzle AMQP PHP >= 5.6

QA

SensioLabsInsight

Service Result
Travis CI (PHP 5.6 .. 7.1) Build Status
Scrutinizer Scrutinizer Code Quality
Code coverage codecov
Packagist Latest Stable Version Total Downloads

Configuration

# amqp.yml
broker:
    host: myRabbit
    login: guest
    password: guest
    vhost: /

# app.yml
id: myApp

Usage

<?php

require '../vendor/autoload.php';

use Puzzle\Configuration\Memory;
use Puzzle\AMQP\Clients\Pecl;
use Puzzle\AMQP\Messages\Json;

$configuration = new Memory(array(
    'amqp/broker/host' => 'myRabbit',
    'amqp/broker/login' => 'guest',
    'amqp/broker/password' => 'guest',
    'amqp/broker/vhost' => '/',
    'app/id' => 'myApp',
));

$client = new Pecl($configuration);

$message = new Json('my.routing.key');
$message->setBody([
    'key' => 'value',
    'key2' => 'value2',
]);

$client->publish('myExchange', $message);

Changelog

2.x -> 3.x

  • Namespace of MessageHook interface was changed

1.x -> 2.x

  • Drop support for Silex 1.x (in favor of Silex 2.x)

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 97.5%
  • Makefile 2.5%