Download the PHP package pushinbr/laravel-rabbit without Composer

On this page you can find all versions of the php package pushinbr/laravel-rabbit. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-rabbit

Laravel Rabbit

Tests Latest Version on Packagist Total Downloads

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.

[!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

Compatibility

Component Supported Versions Notes
PHP ^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 system Laravel Queue Adds 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.
RabbitMQ RabbitMQ 3.x and 4.x compatible AMQP API Management API metrics require the RabbitMQ management plugin.

Feature Overview

Area Included
Laravel queue driver dispatch(), onQueue(), delay(), release(), queue:work, queue:clear, tries, backoff, timeout, retryUntil, failed jobs, batches, chained jobs, and unique jobs.
AMQP publishing Plain text, JSON, headers, message properties, mandatory publish, and publisher confirms.
AMQP consuming Callback consumers, basic_get, ack, nack, reject, idle timeout, max messages, and stop when empty.
Delay support TTL dead-letter queues by default, optional x-delayed-message exchange strategy.
Broker topology Exchanges, 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 API Overview, nodes, queues, queue metrics, exchanges, consumers, bindings, users, permissions, definitions, aliveness test, and generic HTTP requests.
Security Queue payload signing, TLS policy, remote guest guard, message size guard, Management API TLS policy, and config sanitization.
Reliability Publisher confirms, QoS/prefetch, heartbeat, timeouts, host failover, reconnect attempts, and return listeners.

Installation

Install the package:

Publish the configuration file:

Or use the installer command:

Laravel auto-discovery registers:

Binding Purpose
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 facade Optional facade shortcut.

Quick Start

1. Configure RabbitMQ

[!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:

[!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

3. Run the Worker

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

4. Check the Setup

Laravel Queue Driver

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

Laravel Support Matrix

Laravel feature Status Implementation detail
dispatch() Supported Publishes a Laravel queue payload to RabbitMQ.
dispatch()->onQueue('orders') Supported Uses orders as the RabbitMQ queue and default routing key.
delay() / later() Supported Uses TTL dead-letter queues by default.
release($delay) Supported Republishes with incremented attempts and acknowledges the original delivery.
$tries Supported Enforced by Laravel's worker.
backoff() / $backoff Supported Enforced by Laravel's worker through release($delay).
$timeout Supported Enforced by Laravel's worker process.
retryUntil() Supported Enforced by Laravel's worker.
Failed jobs Supported Uses Laravel's configured failed job provider.
Chained jobs Supported Laravel handles the chain metadata in the payload.
Batches Supported Laravel handles batch metadata in the payload.
Unique jobs Supported Laravel handles locks before enqueueing.
queue:work Supported Works as queue:work when QUEUE_CONNECTION=rabbitmq.
queue:clear Supported Purges the target RabbitMQ queue.

Worker Examples

Goal Command
Work 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

Delayed Jobs

Strategy Requires plugin How it works Metric support
ttl No Publishes 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 Yes Publishes through RabbitMQ's delayed message exchange plugin. RabbitMQ does not expose delayed exchange messages as queue depth.
none No Publishes immediately. No delayed count.

Default strategy:

Delayed message exchange strategy:

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.

Management Configuration

Env Default Description
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 empty Optional 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

Laravel queue metric RabbitMQ Management field Fallback 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

Call any Management API endpoint directly:

Use non-GET endpoints through request():

Artisan Commands

Laravel's native queue commands remain the primary interface.

Command Purpose
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.

Command Purpose Safe 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

Checks:

rabbitmq:management

Mode Output
default Cluster 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

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

Command Example
Connectivity 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

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

Publish Text

Publish JSON

Consume Messages

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

Consume Options

Option Default Description
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.

Get One Message

Use a Specific Connection

Facade shortcut:

Topology

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

Manual declarations are also supported:

Production Options

Publisher Confirms

Publisher confirms are enabled by default.

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

QoS / Prefetch

Host Failover

Connection options | Option | Description | | --- | --- | | `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

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.

Env Default Description
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

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

Security Guards

Guard Default Effect
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:

Message Properties

Accepted properties follow AMQPMessage.

Property Description
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.

Testing

Test area Covered
Publishing Text, JSON, properties, confirms, and routing.
Consuming Callback flow, ack, nack, reject, timeout, and round-trip tests.
Laravel queue Dispatch, onQueue, delayed jobs, release, clear, and worker integration.
Management API Metrics mapping, command output, TLS policy, and remote guest guard.
Security Queue payload signing, tamper rejection, insecure TLS, remote guest, config sanitization, and max message size.
Topology Exchanges, queues, bindings, queue arguments, and AMQP table conversion.

All versions of laravel-rabbit with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
illuminate/queue Version ^11.0 || ^12.0 || ^13.0
illuminate/support Version ^11.0 || ^12.0 || ^13.0
php-amqplib/php-amqplib Version ^3.7
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package pushinbr/laravel-rabbit contains the following files

Loading the files please wait ...