Download the PHP package alifcoder/laravel-rabbitmq without Composer
On this page you can find all versions of the php package alifcoder/laravel-rabbitmq. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download alifcoder/laravel-rabbitmq
More information about alifcoder/laravel-rabbitmq
Files in alifcoder/laravel-rabbitmq
Package laravel-rabbitmq
Short Description Simple RabbitMQ client for Laravel with pub/sub and RPC-style request/response support.
License MIT
Informations about the package laravel-rabbitmq
laravel-rabbitmq
Simple RabbitMQ client for Laravel with pub/sub and RPC-style request/response support.
Installation
The service provider and Rabbit facade are auto-discovered. Publish the config:
Configuration
config/rabbitmq.php:
| Key | Env var | Default |
|---|---|---|
host |
RABBITMQ_HOST |
localhost |
port |
RABBITMQ_PORT |
5672 |
user |
RABBITMQ_USER |
guest |
password |
RABBITMQ_PASSWORD |
guest |
rpc_timeout |
RABBITMQ_RPC_TIMEOUT |
10 (seconds) |
default_queue |
RABBITMQ_DEFAULT_QUEUE |
msgs |
What the package provides vs. what you write
Alif\LaravelRabbitmq\Client is a thin, low-level primitive: connection/channel management,
publish(), request()->getResult(), and a consume(queue, callback)->wait() pair where you get
the raw PhpAmqpLib\Message\AMQPMessage and are responsible for acknowledging it yourself.
There's no handler registry, method dispatch, or dead-letter routing built into the package —
that's application logic, not library logic. examples/ shows one way to build it:
a RabbitHandler class (dispatched to by method name, with BaseDto auto-hydrating typed
parameters from the message params) plus a RabbitConsume command that wires it up, RPC replies
included. Copy it into your project and adjust it to taste — see "Consuming" below.
Usage
rabbit() helper (recommended)
rabbit(string $method, array $params = [], ?string $queue = null): Rabbit returns a
Alif\LaravelRabbitmq\Rabbit instance — call ->publish() or ->getResult() on it.
Facade
The same operations are available on the Rabbit facade, which proxies the underlying
Alif\LaravelRabbitmq\Client singleton directly:
Both throw RuntimeException if an RPC request gets no reply within rpc_timeout seconds.
Consuming
- You choose the queue per call — nothing is read from
config('rabbitmq.queues'). - You ack (or nack/reject) the message yourself; the package won't do it for you.
wait()blocks and runs the consume loop; call it once after registering everyconsume()callback you need.
examples/Console/Commands/RabbitConsume.php wraps
this in a full rabbit:consume artisan command — method/DTO dispatch to a RabbitHandler, RPC
replies, and per-message error handling included. Copy it into your project:
Laravel auto-discovers commands under app/Console/Commands/, so php artisan rabbit:consume
works immediately once it's there — no registration needed.
All versions of laravel-rabbitmq with dependencies
illuminate/support Version ^9.0|^10.0|^11.0|^12.0|^13.0
php-amqplib/php-amqplib Version ^3.7
ramsey/uuid Version ^4.2