enqueue/amqp-lib
AMQP transport for Enqueue implementing amqp-interop on top of php-amqplib. Connect to RabbitMQ/AMQP brokers to publish and consume messages, with links to docs, support, and issue tracking. MIT licensed.
Use Case Alignment: The enqueue/amqp-lib package is a message queue transport implementation for AMQP (Advanced Message Queuing Protocol), designed to integrate with the Enqueue library. It enables Laravel/PHP applications to leverage AMQP brokers (e.g., RabbitMQ) for asynchronous task processing, event-driven workflows, and distributed messaging.
Illuminate\Queue) is extensible via queue drivers, making this package a direct replacement or supplement for existing drivers (e.g., sync, database, redis). It aligns with Laravel’s job-based async processing but extends it to AMQP’s pub/sub, RPC, and routing capabilities.Key Features Leveraged:
php-amqplib (underlying library) supports connection reuse, reducing overhead.Laravel Queue Driver:
// config/queue.php
'connections' => [
'amqp' => [
'driver' => 'enqueue',
'dsn' => 'amqp://user:pass@rabbitmq:5672/%2f',
'queue' => 'laravel_jobs',
'options' => [
'transport' => 'amqp-lib', // Uses enqueue/amqp-lib
],
],
];
Alternative: Standalone Usage:
php-amqplib: A mature but lower-level library. May require tuning for performance (e.g., connection timeouts, prefetch counts).sync). Benchmarking is recommended for high-throughput systems.php-amqplib?Primary Use Case:
database, redis) with AMQP for distributed, scalable async processing.Stack Compatibility:
| Component | Compatibility Notes |
|---|---|
| Laravel | Requires enqueue/laravel bridge. |
| PHP | Requires PHP 8.1+. |
| AMQP Broker | Tested with RabbitMQ (primary), but may work with others (e.g., Qpid). |
| Enqueue | Must be configured with amqp-lib transport. |
| Database | Jobs are not stored in DB (unlike Laravel’s database driver); AMQP broker persists them. |
| Monitoring | Integrates with RabbitMQ Management Plugin, Prometheus, or custom metrics. |
Non-Fit Scenarios:
sync driver.database, redis) vs. AMQP.composer require enqueue/laravel enqueue/amqp-lib
config/queue.php:
'connections' => [
'amqp' => [
'driver' => 'enqueue',
'dsn' => 'amqp://user:pass@rabbitmq:5672/%2f',
'queue' => 'laravel_jobs',
'options' => [
'transport' => 'amqp-lib',
'setup' => [
'queue' => ['laravel_jobs'],
'exchange' => ['laravel_jobs'],
'bindings' => [
['laravel_jobs', 'laravel_jobs', ''],
],
],
],
],
],
dispatch(new ProcessPodcast);
database) for validation.php-amqplib settings (e.g., prefetch_count, heartbeat).Illuminate\Contracts\Queue\Queue but works via Enqueue’s bridge. Ensure the bridge is up-to-date.Serializable or use Illuminate\Contracts\Queue\ShouldBeQueued.How can I help you explore Laravel packages today?