PHPackages                             graphaware/php-simplemq - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Queues &amp; Workers](/categories/queues)
4. /
5. graphaware/php-simplemq

ActiveLibrary[Queues &amp; Workers](/categories/queues)

graphaware/php-simplemq
=======================

Github Events API Sync module

1.0.4(10y ago)154PHP

Since Jul 20Pushed 10y ago21 watchersCompare

[ Source](https://github.com/graphaware/php-simplemq)[ Packagist](https://packagist.org/packages/graphaware/php-simplemq)[ RSS](/packages/graphaware-php-simplemq/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (8)Versions (6)Used By (0)

### GraphAware's PHP Simple Message Queue for RabbitMQ

[](#graphawares-php-simple-message-queue-for-rabbitmq)

RabbitMQ's Rapid Application Development.

This library makes possible to create channels, queues, bindings, producers, consumers, .. on the fly by only providing a simple YAML configuration file.

[![Build Status](https://camo.githubusercontent.com/5e3334b56a2a7e6d10f86a2e0f82d188572cf7d72414ffce23546116abc8c05f/68747470733a2f2f7472617669732d63692e6f72672f677261706861776172652f7068702d73696d706c656d712e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/graphaware/php-simplemq)

### Usage

[](#usage)

Require the library dependency :

```
composer require graphaware/php-simplemq
```

Define the connections, exchanges, producers and consumers, eg:

```
simple_mq:
  connections:
    default:
      host: 192.168.59.103
      port: 5672
      user: admin
      password: error
      vhost: "/"

  exchanges:
    logs:
      connection: default
      type: fanout
      durable: true

    error-logs:
      connection: default
      type: direct
      durable: true

  producers:
    logs:
      exchange: logs

    errors:
      exchange: error-logs
      routing_key: error

  consumers:
    logs-printer:
      exchange: logs
      ack: true
      queue:
        name: my-app-all-logs
        durable: true
        qos:
          prefetch_count: 1

    error-logs-recorder:
      exchange: error-logs
      queue:
        name: my-app-error-logs
        durable: true
        qos:
          prefetch_size: 1
        bindings:
          -
            queue: my-app-error-logs
            routing_key: error
```

Bootstrap the library by providing your configuration file location :

```
require_once(__DIR__.'/vendor/autoload.php');

use GraphAware\SimpleMQ\SimpleMQ;

$smq = SimpleMQ::withYAMLConfigFile(__DIR__.'/path_to_your_config_file.yml');
```

Based on the example configuration, producers named `logs` and `errors` as well as consumers named `logs-printer` and `error-logs-recorder` are available through the library.

To retrieve and start consuming queues, you can get the consumer with the following method :

```
$consumer = $smq->getConsumer('logs-printer');

$callback = function($message) {
    print_r($message->body);
};

$consumer->consume($callback);
```

Getting a single message :

```
$message = $consumer->getMessage();
// Returns a AMQPMessage instance
```

Getting more than one message :

```
$messages = $consumer->getMessageBatch(10);
// Returns an array of AMQPMessage
```

Sometimes, there can be a latency between a message is sent and this message to be seen by the producers (for eg in CI suites).

You can define a maxAttempts to reach the batchSize before stopping reading queues :

```
$messages = $consumer->getMessageBatch(10, 20);
```

And to start sending messages to exchanges, it is pretty much the same :

```
$producer = $smq->getProducer('errors');
$message = json_encode(array('id' => 1234, 'text' => 'Hello world'));

$producer->sendMessage($message);
```

The producer and consumers knows exactly, based on the configuration, which routing key to use for direct and topic exchanges and also which binding keys to use for binding queues to exchanges.

---

License: MIT

Author: [Christophe Willemsen](mailto:christophe@graphaware.com)

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity67

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~43 days

Total

5

Last Release

3785d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/c66009f0f147bb7dfcfbbd6837176b2fe6c6e2cdcf82d9ad07ab7d7aa47735f4?d=identicon)[ikwattro](/maintainers/ikwattro)

---

Top Contributors

[![ikwattro](https://avatars.githubusercontent.com/u/1222009?v=4)](https://github.com/ikwattro "ikwattro (18 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/graphaware-php-simplemq/health.svg)

```
[![Health](https://phpackages.com/badges/graphaware-php-simplemq/health.svg)](https://phpackages.com/packages/graphaware-php-simplemq)
```

###  Alternatives

[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.4k5.6M651](/packages/sylius-sylius)[drush/drush

Drush is a command line shell and scripting interface for Drupal, a veritable Swiss Army knife designed to make life easier for those of us who spend some of our working hours hacking away at the command prompt.

2.4k57.4M685](/packages/drush-drush)[simplesamlphp/simplesamlphp

A PHP implementation of a SAML 2.0 service provider and identity provider.

1.1k12.4M193](/packages/simplesamlphp-simplesamlphp)[shopware/platform

The Shopware e-commerce core

3.3k1.5M3](/packages/shopware-platform)[jolicode/castor

A lightweight and modern task runner. Automate everything. In PHP.

53541.0k3](/packages/jolicode-castor)[drupal/core

Drupal is an open source content management platform powering millions of websites and applications.

19562.3M1.3k](/packages/drupal-core)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
