Download the PHP package airygen/laravel-amqp-producer without Composer

On this page you can find all versions of the php package airygen/laravel-amqp-producer. 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-amqp-producer

Laravel AMQP Producer

Laravel-oriented RabbitMQ publisher with:

This library focuses on publishing only. For queue workers / consumers you can use: vyuldashev/laravel-queue-rabbitmq.

Installation

Publish Configuration

Generated file: config/amqp.php

Defining a Payload

Extend ProducerPayload and (optionally) override connection / exchange / routing key.

Basic Publish

Custom Headers

Batch Publish

Retry Strategy

The publisher retries transient AMQP IO / protocol errors (IO / protocol channel exceptions) with exponential backoff:

Custom rule:

Disable retry: Enable jitter:

Jitter multiplies each delay by a random factor ~0.85 - 1.15.

Multi-Connection Example

Automatic Headers Added

MessageFactory injects:

You can still provide additional custom headers; your keys override defaults if duplicated.

Header precedence: custom headers provided in publish() / batchPublish() override automatically injected keys when the same key exists.

Metrics & Stats

The package ships with an in-memory static counter registry Stats intended for lightweight instrumentation or exporting into your own monitoring system.

Global counters:

Per‑connection counters (nested under per_connection[connection_name]):

Example snapshot:

You can reset counters (e.g. at the start of a test or scheduled export) with:

For production telemetry, consider periodically reading the snapshot and pushing to Prometheus / OpenTelemetry.*

Note: These counters are process‑local (not shared across workers). If you run Octane/Swoole multi-worker, aggregate externally.

Behavior: Always Open/Close

For operational safety across PHP-FPM/CLI and worker runtimes (Octane/Swoole/RoadRunner), this package always opens a fresh channel for each publish and closes both channel and connection afterwards.

Octane / Swoole / RoadRunner

Health Check Command

Run a simple connectivity probe:

Exit code is non‑zero on failure (suitable for container readiness / liveness probes). Long-lived worker environments reuse PHP processes, so you must ensure stale connections/channels don't leak across deploys or forks.

Built-in safeguards:

Recommended practices:

  1. Avoid holding a Publisher instance in static singletons you construct before workers fork.
  2. Call app(ProducerInterface::class) per request/job (container will reuse safe singleton manager underneath).
  3. If you rotate workers periodically, no extra action is needed—the hook already clears state.
  4. For Swoole without Octane events, you can manually schedule: ConnectionManager::reset() during your custom lifecycle hooks.

Optional manual reset example:

TLS / SSL (Optional)

If you need TLS encryption, enable and configure the SSL related options inside config/amqp.php:

The factory will build a stream context when ssl is truthy and any of the certificate fields are present. If verify_peer is enabled, ensure cafile is supplied.

Roadmap

Development

Dockerized Workflow

All commands are wrapped to run inside the php service defined in docker-compose.yml.

Startup & install:

Using Makefile targets:

Manual (host) without Docker wrapper:

Management UI: http://localhost:15672 (guest / guest)

If you prefer to run host-native (without docker) use the host:* scripts or call PHPUnit directly.

Prometheus Metrics (Skeleton)

The package keeps lightweight in-memory counters (not persisted). A minimal Prometheus text exporter is provided.

Artisan command:

Example output:

Per-connection metrics are emitted with a connection label, e.g.:

You can bind your own implementation of Airygen\\RabbitMQ\\Contracts\\MetricsExporterInterface if you need richer aggregation or to integrate with an existing metrics system.

License

MIT


All versions of laravel-amqp-producer with dependencies

PHP Build Version
Package Version
Requires php Version >=8.2
illuminate/support Version ^10.0 || ^11.0 || ^12.0
php-amqplib/php-amqplib Version ^3.5
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 airygen/laravel-amqp-producer contains the following files

Loading the files please wait ...