PHPackages                             mjohann/simple-rabbitmq - 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. mjohann/simple-rabbitmq

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

mjohann/simple-rabbitmq
=======================

Simple RabbitMQ is a PHP class that offers a clean and reusable abstraction for working with RabbitMQ. It simplifies the process of connecting to message queues and performing common operations like publishing messages, consuming queues, acknowledging deliveries, and managing exchanges and bindings — all without having to deal with the complexity of the underlying configuration.

v1.1.0(1y ago)014MITPHPPHP ^8.0

Since Apr 16Pushed 1y ago1 watchersCompare

[ Source](https://github.com/matheusjohannaraujo/simple-rabbitmq)[ Packagist](https://packagist.org/packages/mjohann/simple-rabbitmq)[ RSS](/packages/mjohann-simple-rabbitmq/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (1)Versions (3)Used By (0)

[Simple RabbitMQ](https://github.com/matheusjohannaraujo/simple-rabbitmq)
=========================================================================

[](#simple-rabbitmq)

**Simple RabbitMQ** is a PHP class that offers a clean and reusable abstraction for working with RabbitMQ. It simplifies the process of connecting to message queues and performing common operations like publishing messages, consuming queues, acknowledging deliveries, and managing exchanges and bindings — all without having to deal with the complexity of the underlying configuration.

📦 Installation
--------------

[](#-installation)

You can install the library via [Packagist/Composer](https://packagist.org/packages/mjohann/simple-rabbitmq):

```
composer require mjohann/simple-rabbitmq
```

⚙️ Requirements
---------------

[](#️-requirements)

- PHP 8.0 or higher

🚀 Features
----------

[](#-features)

- Simple RabbitMQ uses [`enqueue/amqp-lib`](https://packagist.org/packages/enqueue/amqp-lib) as a dependency
- Supported:
    - \_\_construct — Configures the connection parameters (e.g., host, port, credentials).
    - open — Opens a connection to the RabbitMQ server.
    - close — Closes the connection.
    - exchange($name) — Declares an exchange.
    - pubExchange($message) — Publishes a message to the exchange.
    - queue($name) — Declares a queue.
    - queueBind() — Binds a queue to an exchange.
    - pubQueue($message) — Publishes a message to the queue.
    - sub($callback) — Subscribes a callback function to consume messages from the queue.
    - waitCallbacks($milliseconds) — Waits for messages and dispatches them to the subscribed callbacks for a given duration.
    - readMessage() — (Commented out, but exists) Likely reads a single message from the queue.
    - acknowledge($message) — Acknowledges receipt of a message (seen in the consumer callback via $consumer-&gt;acknowledge()).

🧪 Usage Example
---------------

[](#-usage-example)

### Publisher

[](#publisher)

```
