PHPackages                             pushinbr/laravel-rabbit - 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. pushinbr/laravel-rabbit

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

pushinbr/laravel-rabbit
=======================

RabbitMQ client library for Laravel with publishing, consuming, topology, TLS, confirms, failover, and security guards.

v0.1.3(2w ago)020↓33.3%MITPHPPHP ^8.2CI passing

Since May 18Pushed 2w agoCompare

[ Source](https://github.com/push-in/laravel-rabbit)[ Packagist](https://packagist.org/packages/pushinbr/laravel-rabbit)[ Docs](https://github.com/push-in/laravel-rabbit)[ RSS](/packages/pushinbr-laravel-rabbit/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (4)Dependencies (5)Versions (5)Used By (0)

Laravel Rabbit
==============

[](#laravel-rabbit)

[![Tests](https://github.com/push-in/laravel-rabbit/actions/workflows/tests.yml/badge.svg)](https://github.com/push-in/laravel-rabbit/actions/workflows/tests.yml)[![Latest Version on Packagist](https://camo.githubusercontent.com/64cab3e34ca966a5884ed5b88ee0ae22081a58e6b60407048c3e06b8b4669ee7/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f70757368696e62722f6c61726176656c2d7261626269742e737667)](https://packagist.org/packages/pushinbr/laravel-rabbit)[![Total Downloads](https://camo.githubusercontent.com/5ee5346d9b89076aaf7fb862590fdf1abdb38f0678b64e685763b57dd225814d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f70757368696e62722f6c61726176656c2d7261626269742e737667)](https://packagist.org/packages/pushinbr/laravel-rabbit)[![License](https://camo.githubusercontent.com/10705df5f6b4e5d9bee9e380d92aba7ad0f5340b2104cd8b5cf9cd8da3cf2190/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f707573682d696e2f6c61726176656c2d7261626269742e737667)](LICENSE.md)

RabbitMQ library for Laravel with a native queue driver, AMQP 0-9-1 publishing and consuming, topology declarations, TLS, publisher confirms, QoS, host failover, RabbitMQ Management HTTP API support, and security validation.

```
use App\Jobs\ProcessOrder;

ProcessOrder::dispatch($order)->onQueue('orders');
```

Important

The package registers a Laravel queue driver named `rabbitmq`. When `QUEUE_CONNECTION=rabbitmq`, Laravel's native `dispatch()`, `onQueue()`, `delay()`, `queue:work`, retries, backoff, failed jobs, batches, chained jobs, and unique jobs continue to work through the standard Laravel worker flow.

Table of Contents
-----------------

[](#table-of-contents)

- [Compatibility](#compatibility)
- [Feature Overview](#feature-overview)
- [Installation](#installation)
- [Quick Start](#quick-start)
- [Laravel Queue Driver](#laravel-queue-driver)
- [Delayed Jobs](#delayed-jobs)
- [RabbitMQ Management API](#rabbitmq-management-api)
- [Artisan Commands](#artisan-commands)
- [Low-Level AMQP Usage](#low-level-amqp-usage)
- [Topology](#topology)
- [Production Options](#production-options)
- [Security](#security)
- [Testing](#testing)

Compatibility
-------------

[](#compatibility)

ComponentSupported VersionsNotesPHP`^8.2`Tested on modern PHP versions used by Laravel 11, 12, and 13.Laravel`^11.0`, `^12.0`, `^13.0`Package discovery registers the service provider and facade automatically.Queue systemLaravel QueueAdds `queue.connections.rabbitmq` and works with the normal worker commands.AMQP driver`php-amqplib/php-amqplib ^3.7`Used for AMQP 0-9-1 connections and messages.RabbitMQRabbitMQ 3.x and 4.x compatible AMQP APIManagement API metrics require the RabbitMQ management plugin.Feature Overview
----------------

[](#feature-overview)

AreaIncludedLaravel queue driver`dispatch()`, `onQueue()`, `delay()`, `release()`, `queue:work`, `queue:clear`, `tries`, `backoff`, `timeout`, `retryUntil`, failed jobs, batches, chained jobs, and unique jobs.AMQP publishingPlain text, JSON, headers, message properties, mandatory publish, and publisher confirms.AMQP consumingCallback consumers, `basic_get`, ack, nack, reject, idle timeout, max messages, and stop when empty.Delay supportTTL dead-letter queues by default, optional `x-delayed-message` exchange strategy.Broker topologyExchanges, queues, bindings, queue arguments, exchange arguments, and automatic declarations.Operations`rabbitmq:install`, `rabbitmq:check`, `rabbitmq:setup`, `rabbitmq:stats`, `rabbitmq:management`, `rabbitmq:doctor`, `rabbitmq:consume-test`, and `rabbitmq:purge`.Management APIOverview, nodes, queues, queue metrics, exchanges, consumers, bindings, users, permissions, definitions, aliveness test, and generic HTTP requests.SecurityQueue payload signing, TLS policy, remote `guest` guard, message size guard, Management API TLS policy, and config sanitization.ReliabilityPublisher confirms, QoS/prefetch, heartbeat, timeouts, host failover, reconnect attempts, and return listeners.Installation
------------

[](#installation)

Install the package:

```
composer require pushinbr/laravel-rabbit
```

Publish the configuration file:

```
php artisan vendor:publish --tag=laravel-rabbit-config
```

Or use the installer command:

```
php artisan rabbitmq:install
```

Laravel auto-discovery registers:

BindingPurpose`Pushin\LaravelRabbit\LaravelRabbit`Main package service.`laravel-rabbit`Container alias for the main service.`laravel-rabbit.manager`Connection manager alias.`laravel-rabbit.management`RabbitMQ Management API client alias.`LaravelRabbit` facadeOptional facade shortcut.```
use Pushin\LaravelRabbit\Facades\LaravelRabbit;
```

Quick Start
-----------

[](#quick-start)

### 1. Configure RabbitMQ

[](#1-configure-rabbitmq)

```
QUEUE_CONNECTION=rabbitmq

LARAVEL_RABBIT_CONNECTION=default
RABBITMQ_HOST=127.0.0.1
RABBITMQ_PORT=5672
RABBITMQ_VHOST=/
RABBITMQ_USER=guest
RABBITMQ_PASSWORD=guest
RABBITMQ_QUEUE=default
RABBITMQ_EXCHANGE=
RABBITMQ_ROUTING_KEY=
```

Tip

Leave `RABBITMQ_QUEUE_ROUTING_KEY` unset for most Laravel apps. The package will use the queue name from `onQueue()` as the routing key.

Optional payload signing for the queue driver:

```
RABBITMQ_QUEUE_SIGN_PAYLOADS=true
RABBITMQ_QUEUE_SIGNING_KEY="${APP_KEY}"
RABBITMQ_QUEUE_INVALID_SIGNATURE_REQUEUE=false
```

Important

Payload signing protects the Laravel worker from unsigned or tampered queue messages. Enable it only after all producers that publish Laravel jobs through RabbitMQ use the same signing key, because unsigned existing messages will be rejected when verification is enabled.

### 2. Dispatch a Job

[](#2-dispatch-a-job)

```
use App\Jobs\ProcessOrder;

ProcessOrder::dispatch($order)->onQueue('orders');
```

### 3. Run the Worker

[](#3-run-the-worker)

```
php artisan queue:work --queue=orders
```

Because `QUEUE_CONNECTION=rabbitmq`, the command above uses RabbitMQ without passing the connection name. This also works:

```
php artisan queue:work rabbitmq --queue=orders
```

### 4. Check the Setup

[](#4-check-the-setup)

```
php artisan rabbitmq:doctor
php artisan rabbitmq:stats orders
```

Laravel Queue Driver
--------------------

[](#laravel-queue-driver)

The `laravel_queue` config section is merged automatically into `queue.connections.rabbitmq`.

```
'laravel_queue' => [
    'driver' => 'rabbitmq',
    'rabbit_connection' => env('LARAVEL_RABBIT_CONNECTION', 'default'),
    'queue' => env('RABBITMQ_QUEUE', 'default'),
    'exchange' => env('RABBITMQ_QUEUE_EXCHANGE', env('RABBITMQ_EXCHANGE', '')),
    'exchange_type' => env('RABBITMQ_QUEUE_EXCHANGE_TYPE', 'direct'),
    'routing_key' => env('RABBITMQ_QUEUE_ROUTING_KEY'),
    'declare' => true,
    'durable' => true,
    'delivery_mode' => 2,
    'after_commit' => false,
    'retry_after' => 90,
    'security' => [
        'sign_payloads' => false,
        'verify_payload_signatures' => false,
        'signing_key' => env('APP_KEY'),
        'invalid_signature_requeue' => false,
    ],
    'delay' => [
        'strategy' => 'ttl',
        'queue_prefix' => 'laravel.delay.',
    ],
],
```

### Laravel Support Matrix

[](#laravel-support-matrix)

Laravel featureStatusImplementation detail`dispatch()`SupportedPublishes a Laravel queue payload to RabbitMQ.`dispatch()->onQueue('orders')`SupportedUses `orders` as the RabbitMQ queue and default routing key.`delay()` / `later()`SupportedUses TTL dead-letter queues by default.`release($delay)`SupportedRepublishes with incremented attempts and acknowledges the original delivery.`$tries`SupportedEnforced by Laravel's worker.`backoff()` / `$backoff`SupportedEnforced by Laravel's worker through `release($delay)`.`$timeout`SupportedEnforced by Laravel's worker process.`retryUntil()`SupportedEnforced by Laravel's worker.Failed jobsSupportedUses Laravel's configured failed job provider.Chained jobsSupportedLaravel handles the chain metadata in the payload.BatchesSupportedLaravel handles batch metadata in the payload.Unique jobsSupportedLaravel handles locks before enqueueing.`queue:work`SupportedWorks as `queue:work` when `QUEUE_CONNECTION=rabbitmq`.`queue:clear`SupportedPurges the target RabbitMQ queue.### Worker Examples

[](#worker-examples)

GoalCommandWork the default RabbitMQ connection`php artisan queue:work`Work one queue`php artisan queue:work --queue=orders`Explicit RabbitMQ connection`php artisan queue:work rabbitmq --queue=orders`Process one job`php artisan queue:work --queue=orders --once`Clear a queue`php artisan queue:clear rabbitmq --queue=orders`Retry failed jobs`php artisan queue:retry all`### Job Example

[](#job-example)

```
namespace App\Jobs;

use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Queue\Queueable;

class ProcessOrder implements ShouldQueue
{
    use Queueable;

    public int $tries = 5;

    public int $timeout = 60;

    public function __construct(public int $orderId)
    {
    }

    public function backoff(): array
    {
        return [10, 30, 60];
    }

    public function handle(): void
    {
        // Process the order.
    }
}
```

```
ProcessOrder::dispatch($order->id)
    ->onQueue('orders')
    ->delay(now()->addMinutes(5));
```

Delayed Jobs
------------

[](#delayed-jobs)

StrategyRequires pluginHow it worksMetric support`ttl`NoPublishes to a per-delay TTL queue that dead-letters back to the target queue.`delayed` can be calculated through the Management API.`x-delayed-message`YesPublishes through RabbitMQ's delayed message exchange plugin.RabbitMQ does not expose delayed exchange messages as queue depth.`none`NoPublishes immediately.No delayed count.Default strategy:

```
RABBITMQ_QUEUE_DELAY_STRATEGY=ttl
RABBITMQ_QUEUE_DELAY_PREFIX=laravel.delay.
```

Delayed message exchange strategy:

```
RABBITMQ_QUEUE_DELAY_STRATEGY=x-delayed-message
RABBITMQ_QUEUE_DELAY_EXCHANGE=laravel.delayed
```

RabbitMQ Management API
-----------------------

[](#rabbitmq-management-api)

The Management API integration is optional. The queue driver can dispatch and consume jobs without it. Enable it when you want broker-level metrics and operational visibility.

```
RABBITMQ_MANAGEMENT_ENABLED=true
RABBITMQ_MANAGEMENT_SCHEME=http
RABBITMQ_MANAGEMENT_HOST=127.0.0.1
RABBITMQ_MANAGEMENT_PORT=15672
RABBITMQ_MANAGEMENT_USER=guest
RABBITMQ_MANAGEMENT_PASSWORD=guest
```

### Management Configuration

[](#management-configuration)

EnvDefaultDescription`RABBITMQ_MANAGEMENT_ENABLED``false`Enables the Management API client.`RABBITMQ_MANAGEMENT_SCHEME``http`Use `http` or `https`.`RABBITMQ_MANAGEMENT_HOST``RABBITMQ_HOST` or `127.0.0.1`Management API host.`RABBITMQ_MANAGEMENT_PORT``15672`Management API port.`RABBITMQ_MANAGEMENT_BASE_PATH`emptyOptional reverse proxy base path.`RABBITMQ_MANAGEMENT_VHOST``RABBITMQ_VHOST` or `/`Default virtual host for API calls.`RABBITMQ_MANAGEMENT_USER``RABBITMQ_USER` or `guest`Management API user.`RABBITMQ_MANAGEMENT_PASSWORD``RABBITMQ_PASSWORD` or `guest`Management API password.`RABBITMQ_MANAGEMENT_TIMEOUT``5.0`HTTP timeout in seconds.`RABBITMQ_MANAGEMENT_VERIFY_TLS``true`Verifies TLS peer and peer name for HTTPS.`RABBITMQ_MANAGEMENT_ALLOW_INSECURE_TLS``false`Allows disabled HTTPS verification when explicitly needed.`RABBITMQ_MANAGEMENT_FORBID_GUEST_REMOTE``true`Rejects `guest` on non-local hosts.`RABBITMQ_MANAGEMENT_CAFILE``RABBITMQ_SSL_CAFILE`Optional CA file for HTTPS.`RABBITMQ_MANAGEMENT_CAPATH``RABBITMQ_SSL_CAPATH`Optional CA path for HTTPS.### Metrics Mapping

[](#metrics-mapping)

Laravel queue metricRabbitMQ Management fieldFallback without Management API`size()` / `total``messages`AMQP queue declaration message count.`pendingSize()` / `pending``messages_ready`AMQP queue declaration message count.`reservedSize()` / `reserved``messages_unacknowledged``0``delayedSize()` / `delayed`Sum of matching TTL delay queues`0`Note

`delayedSize()` is accurate for this package's default TTL delay queues. RabbitMQ does not expose queued messages inside an `x-delayed-message` exchange as normal queue depth.

### Management Client Usage

[](#management-client-usage)

```
use Pushin\LaravelRabbit\Facades\LaravelRabbit;

$overview = LaravelRabbit::management()->overview();
$orders = LaravelRabbit::management()->queue('orders');
$queues = LaravelRabbit::management()->queues('/');
$nodes = LaravelRabbit::management()->nodes();
$definitions = LaravelRabbit::management()->definitions();
```

Call any Management API endpoint directly:

```
$policies = LaravelRabbit::management()->get('/api/policies/%2F');
```

Use non-GET endpoints through `request()`:

```
LaravelRabbit::management()->request('PUT', '/api/policies/%2F/ttl', body: [
    'pattern' => '^orders\\.',
    'definition' => ['message-ttl' => 60000],
    'priority' => 0,
    'apply-to' => 'queues',
]);
```

Artisan Commands
----------------

[](#artisan-commands)

Laravel's native queue commands remain the primary interface.

CommandPurpose`php artisan queue:work --queue=orders`Work the `orders` queue using RabbitMQ when `QUEUE_CONNECTION=rabbitmq`.`php artisan queue:work rabbitmq --queue=orders`Work the `orders` queue with an explicit queue connection.`php artisan queue:clear rabbitmq --queue=orders`Clear a queue through Laravel's native queue command.`php artisan queue:failed`List failed jobs from Laravel's failed job provider.`php artisan queue:retry all`Retry failed jobs through Laravel.The package also adds RabbitMQ-specific operational commands.

CommandPurposeSafe for deploy checks`rabbitmq:install`Publish config and print env examples.No`rabbitmq:check`Verify connection and optionally passively check a queue.Yes`rabbitmq:setup`Declare configured topology and optionally one queue-driver queue.Yes, when declaration is expected.`rabbitmq:stats`Show queue metrics through the Laravel queue driver.Yes`rabbitmq:management`Inspect broker overview, queues, or one queue through the Management API.Yes`rabbitmq:doctor`Run config, security, connection, Management API, and optional round-trip checks.Yes`rabbitmq:consume-test`Publish and consume a round-trip test message.Yes, with a test queue.`rabbitmq:purge`Purge a queue.No### `rabbitmq:doctor`

[](#rabbitmqdoctor)

```
php artisan rabbitmq:doctor
php artisan rabbitmq:doctor default --queue=laravel-rabbit.doctor
php artisan rabbitmq:doctor --skip-roundtrip
```

Checks:

- connection configuration exists
- security policy passes
- `QUEUE_CONNECTION` is `rabbitmq`
- Laravel queue driver is registered
- AMQP channel can open
- Management API is reachable when enabled
- optional publish/consume round trip succeeds

### `rabbitmq:management`

[](#rabbitmqmanagement)

```
php artisan rabbitmq:management
php artisan rabbitmq:management --queue=orders
php artisan rabbitmq:management --queues
php artisan rabbitmq:management --vhost=/
```

ModeOutputdefaultCluster name, RabbitMQ version, object totals, and message totals.`--queue=orders`Queue state, ready messages, reserved messages, total messages, consumers, memory, and idle time.`--queues`Queue list with ready, reserved, total, consumers, and state.### `rabbitmq:stats`

[](#rabbitmqstats)

```
php artisan rabbitmq:stats orders
```

When the Management API is enabled, this command shows real broker metrics. Without it, RabbitMQ's AMQP queue declaration only provides total ready depth, so reserved and delayed counts are not available.

### Other Commands

[](#other-commands)

CommandExampleConnectivity check`php artisan rabbitmq:check default --queue=orders`Topology setup`php artisan rabbitmq:setup default --queue=orders`Consume test`php artisan rabbitmq:consume-test default --queue=healthcheck`Purge queue`php artisan rabbitmq:purge orders --force`Low-Level AMQP Usage
--------------------

[](#low-level-amqp-usage)

Use the facade when you need direct AMQP behavior outside Laravel's queue worker.

### Publish Text

[](#publish-text)

```
use Pushin\LaravelRabbit\Facades\LaravelRabbit;

LaravelRabbit::publish(
    body: 'order created',
    routingKey: 'orders.created',
    exchange: 'events',
);
```

### Publish JSON

[](#publish-json)

```
use Illuminate\Support\Str;
use Pushin\LaravelRabbit\Facades\LaravelRabbit;

LaravelRabbit::publishJson(
    payload: ['order_id' => 123],
    routingKey: 'orders.created',
    exchange: 'events',
    properties: [
        'correlation_id' => (string) Str::uuid(),
        'headers' => [
            'tenant' => 'pushin',
        ],
    ],
);
```

### Consume Messages

[](#consume-messages)

```
use PhpAmqpLib\Message\AMQPMessage;
use Pushin\LaravelRabbit\Facades\LaravelRabbit;

LaravelRabbit::consume(function (AMQPMessage $message): void {
    $payload = json_decode($message->getBody(), true, flags: JSON_THROW_ON_ERROR);

    // Process the message.
});
```

By default, a message is acknowledged when the callback finishes without errors. If the callback returns `false`, the message is nacked.

```
use PhpAmqpLib\Message\AMQPMessage;
use Pushin\LaravelRabbit\Facades\LaravelRabbit;
use Pushin\LaravelRabbit\ValueObjects\ConsumerResult;

LaravelRabbit::consume(function (AMQPMessage $message): ConsumerResult {
    return ConsumerResult::nack(requeue: true);
});
```

### Consume Options

[](#consume-options)

OptionDefaultDescription`tag``''`Consumer tag.`no_ack``false`When true, RabbitMQ auto-acknowledges deliveries.`exclusive``false`Exclusive consumer.`wait_timeout``1.0`Wait timeout per consume loop.`idle_timeout``null`Stop after idle timeout.`max_messages``null`Stop after consuming this many messages.`stop_when_empty``false`Stop after the queue is empty.`ack_on_success``true`Ack when callback succeeds.`nack_on_false``true`Nack when callback returns `false`.`nack_on_false_requeue``false`Requeue when callback returns `false`.`reject_on_exception``true`Reject when callback throws.`reject_on_exception_requeue``false`Requeue when callback throws.```
LaravelRabbit::consume($callback, options: [
    'tag' => 'orders-worker-1',
    'wait_timeout' => 1.0,
    'idle_timeout' => 30.0,
    'max_messages' => 100,
]);
```

### Get One Message

[](#get-one-message)

```
$message = LaravelRabbit::get(queue: 'orders');

if ($message !== null) {
    // Process and manually acknowledge when noAck=false.
    $message->ack();
}
```

### Use a Specific Connection

[](#use-a-specific-connection)

```
LaravelRabbit::connection('analytics')->publishJson(
    payload: ['event' => 'checkout'],
    routingKey: 'analytics.checkout',
);
```

Facade shortcut:

```
LaravelRabbit::publishJson(
    payload: ['event' => 'checkout'],
    routingKey: 'analytics.checkout',
    connection: 'analytics',
);
```

Topology
--------

[](#topology)

The package can automatically declare exchanges, queues, and bindings when a channel is opened.

```
'topology' => [
    'auto_declare' => true,
    'exchanges' => [
        'events' => [
            'type' => 'topic',
            'durable' => true,
            'auto_delete' => false,
        ],
    ],
    'queues' => [
        'orders' => [
            'durable' => true,
            'arguments' => [
                'x-dead-letter-exchange' => 'events.dlx',
                'x-message-ttl' => 60000,
            ],
        ],
    ],
    'bindings' => [
        [
            'queue' => 'orders',
            'exchange' => 'events',
            'routing_key' => 'orders.*',
        ],
    ],
],
```

Manual declarations are also supported:

```
$rabbit = LaravelRabbit::connection();

$rabbit->declareExchange('events', ['type' => 'topic', 'durable' => true]);
$rabbit->declareQueue('orders', ['durable' => true]);
$rabbit->bindQueue('orders', 'events', 'orders.*');
```

Production Options
------------------

[](#production-options)

### Publisher Confirms

[](#publisher-confirms)

Publisher confirms are enabled by default.

```
'publisher_confirms' => [
    'enabled' => true,
    'wait' => true,
    'timeout' => 5.0,
    'wait_for_returns' => false,
],
```

To handle returned messages, publish with `mandatory=true` and register a return listener.

```
use PhpAmqpLib\Message\AMQPMessage;

LaravelRabbit::connection()
    ->onReturned(function ($replyCode, $replyText, $exchange, $routingKey, AMQPMessage $message): void {
        report("RabbitMQ returned message: {$replyCode} {$replyText}");
    })
    ->publish('payload', options: [
        'mandatory' => true,
        'wait_for_returns' => true,
    ]);
```

### QoS / Prefetch

[](#qos--prefetch)

```
'qos' => [
    'enabled' => true,
    'prefetch_size' => 0,
    'prefetch_count' => 10,
    'global' => false,
],
```

```
LaravelRabbit::connection()->qos(prefetchCount: 25);
```

### Host Failover

[](#host-failover)

```
'connections' => [
    'default' => [
        'user' => env('RABBITMQ_USER'),
        'password' => env('RABBITMQ_PASSWORD'),
        'vhost' => '/',
        'hosts' => [
            ['host' => 'rabbit-a.internal', 'port' => 5671],
            ['host' => 'rabbit-b.internal', 'port' => 5671],
        ],
        'ssl' => [
            'enabled' => true,
            'verify_peer' => true,
            'verify_peer_name' => true,
        ],
        'reconnect' => [
            'attempts' => 3,
            'sleep_ms' => 250,
            'multiplier' => 1.5,
        ],
    ],
],
```

Connection optionsOptionDescription`host`, `port`, `vhost`, `user`, `password`RabbitMQ connection target and credentials.`hosts`Host list for failover. Host entries inherit root options and may override them.`connection_name`Name shown in RabbitMQ connection metadata.`io_type``stream` or `socket`.`lazy`Defer connection creation until first use.`insist`AMQP insist flag.`login_method``AMQPLAIN`, `PLAIN`, or `EXTERNAL`.`login_response`Optional login response.`locale`AMQP locale, usually `en_US`.`connection_timeout`TCP connection timeout.`read_timeout`Socket read timeout.`write_timeout`Socket write timeout.`channel_rpc_timeout`Channel RPC timeout.`heartbeat`RabbitMQ heartbeat interval.`keepalive`TCP keepalive flag.`send_buffer_size`Optional send buffer size.`dispatch_signals`Whether php-amqplib dispatches signals.`protocol_strict_fields`Strict AMQP field validation.`debug_packets`Packet debug flag.Security
--------

[](#security)

### Queue Payload Signing

[](#queue-payload-signing)

Queue payload signing is an optional defense against job injection. When enabled, the driver adds an HMAC signature to every Laravel queue payload it publishes. During `queue:work`, messages without a valid signature are rejected before Laravel attempts to execute the job.

```
RABBITMQ_QUEUE_SIGN_PAYLOADS=true
RABBITMQ_QUEUE_SIGNING_KEY="${APP_KEY}"
RABBITMQ_QUEUE_INVALID_SIGNATURE_REQUEUE=false
```

EnvDefaultDescription`RABBITMQ_QUEUE_SIGN_PAYLOADS``false`Adds an HMAC signature to new queue payloads.`RABBITMQ_QUEUE_VERIFY_PAYLOAD_SIGNATURES`same as `RABBITMQ_QUEUE_SIGN_PAYLOADS`Verifies signatures before returning a job to Laravel's worker.`RABBITMQ_QUEUE_SIGNING_KEY``APP_KEY`Secret key used for HMAC signing. Use the same value across all app instances that publish or consume these jobs.`RABBITMQ_QUEUE_INVALID_SIGNATURE_REQUEUE``false`When false, invalid messages are nacked without requeue to avoid poison-message loops.Note

Payload signing does not replace broker security. Keep RabbitMQ credentials scoped per app, restrict vhost permissions, use TLS outside local development, and do not allow untrusted systems to publish into Laravel worker queues.

### TLS

[](#tls)

```
RABBITMQ_SSL=true
RABBITMQ_PORT=5671
RABBITMQ_SSL_CAFILE=/etc/ssl/certs/ca.pem
RABBITMQ_SSL_VERIFY_PEER=true
RABBITMQ_SSL_VERIFY_PEER_NAME=true
```

```
'ssl' => [
    'enabled' => true,
    'cafile' => '/path/ca.pem',
    'capath' => null,
    'local_cert' => '/path/client.pem',
    'local_pk' => '/path/client.key',
    'passphrase' => env('RABBITMQ_SSL_PASSPHRASE'),
    'verify_peer' => true,
    'verify_peer_name' => true,
    'ciphers' => null,
    'security_level' => null,
    'crypto_method' => 'STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT',
],
```

For security, `verify_peer=false` or `verify_peer_name=false` throws an exception unless `security.allow_insecure_tls=true`.

### Security Guards

[](#security-guards)

```
'security' => [
    'require_tls' => false,
    'allow_insecure_tls' => false,
    'enforce_tls_peer_verification' => true,
    'forbid_guest_on_remote_hosts' => true,
    'max_message_size' => null,
],
```

GuardDefaultEffect`require_tls``false`Rejects non-TLS AMQP connections when enabled.`allow_insecure_tls``false`Required before disabling TLS peer verification.`enforce_tls_peer_verification``true`Requires peer and peer-name verification for TLS.`forbid_guest_on_remote_hosts``true`Rejects the `guest` user outside local hosts.`max_message_size``null`Rejects publishes larger than the configured byte limit.Recommendations:

- Use TLS outside local development.
- Do not use the `guest` user on remote hosts.
- Keep `verify_peer` and `verify_peer_name` enabled.
- Configure `max_message_size` when your application has a known payload limit.
- Prefer publisher confirms for important flows.

Message Properties
------------------

[](#message-properties)

Accepted properties follow `AMQPMessage`.

PropertyDescription`content_type`MIME type of the payload.`content_encoding`Payload encoding.`headers` / `application_headers`Application headers.`delivery_mode`Use `2` for persistent messages.`priority`Message priority.`correlation_id`Correlation id for tracing or RPC.`reply_to`Reply queue.`expiration`Per-message TTL in milliseconds as a string.`message_id`Message id.`timestamp`Message timestamp.`type`Application message type.`user_id`User id.`app_id`Application id.`cluster_id`Cluster id.```
LaravelRabbit::publishJson(
    ['order_id' => 123],
    properties: [
        'delivery_mode' => 2,
        'expiration' => '60000',
        'priority' => 5,
        'headers' => [
            'source' => 'checkout',
        ],
    ],
);
```

Testing
-------

[](#testing)

```
composer test
composer test:unit
composer test:feature
```

Test areaCoveredPublishingText, JSON, properties, confirms, and routing.ConsumingCallback flow, ack, nack, reject, timeout, and round-trip tests.Laravel queueDispatch, `onQueue`, delayed jobs, release, clear, and worker integration.Management APIMetrics mapping, command output, TLS policy, and remote `guest` guard.SecurityQueue payload signing, tamper rejection, insecure TLS, remote `guest`, config sanitization, and max message size.TopologyExchanges, queues, bindings, queue arguments, and AMQP table conversion.

###  Health Score

40

—

FairBetter than 86% of packages

Maintenance97

Actively maintained with recent releases

Popularity9

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity39

Early-stage or recently created project

 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 ~2 days

Total

4

Last Release

15d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/338f72fe17fbcddcf587cc3467061a3b9225bfe196ba1599860e96c84d6f00d3?d=identicon)[DavidWilliamBalbino](/maintainers/DavidWilliamBalbino)

---

Top Contributors

[![DavidWilliamBalbino](https://avatars.githubusercontent.com/u/19325395?v=4)](https://github.com/DavidWilliamBalbino "DavidWilliamBalbino (7 commits)")

---

Tags

laravelqueuerabbitmqAMQP

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/pushinbr-laravel-rabbit/health.svg)

```
[![Health](https://phpackages.com/badges/pushinbr-laravel-rabbit/health.svg)](https://phpackages.com/packages/pushinbr-laravel-rabbit)
```

###  Alternatives

[laravel/horizon

Dashboard and code-driven configuration for Laravel queues.

4.1k91.3M277](/packages/laravel-horizon)[bschmitt/laravel-amqp

AMQP wrapper for Laravel and Lumen to publish and consume messages

2782.4M7](/packages/bschmitt-laravel-amqp)[nuwber/rabbitevents

The Nuwber RabbitEvents package

119525.8k4](/packages/nuwber-rabbitevents)[iamfarhad/laravel-rabbitmq

Native ext-amqp RabbitMQ queue driver for Laravel production workloads with connection pooling, publisher confirms, Horizon support, Octane support, quorum queues, and high-performance workers

3317.9k](/packages/iamfarhad-laravel-rabbitmq)

PHPackages © 2026

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