Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Php Amqplib Laravel Package

videlalvaro/php-amqplib

Pure PHP implementation of the AMQP 0-9-1 protocol, tested against RabbitMQ. This library powers the official RabbitMQ PHP tutorials and supports publisher confirms, basic nack, consumer cancel notify, and exchange-to-exchange bindings.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture fit. php-amqplib is a pure-PHP implementation of AMQP 0-9-1, which is the single most important fact for a Laravel shop: it requires no ext-amqp, no C extension, and no broker-specific toolchain. It installs via Composer and runs anywhere PHP runs — containers, shared hosting, CI images — which materially lowers environment drift versus the PECL-based alternative. The trade-off is that it is a protocol client, not a framework integration. It ships no service provider, no config publishing, no facade, and no Laravel queue driver. It is deliberately a low-level library: AMQPStreamConnection, AMQPChannel, basic_publish, basic_consume. In practice this means the real integration decision is not "should we use php-amqplib" (it is the de facto dependency of nearly every Laravel RabbitMQ package) but "do we consume it directly or through a wrapper such as vladimir-yuldashev/laravel-queue-rabbitmq or enqueue/amqp-lib."

Integration feasibility. High. Composer install, straightforward credentials, multi-host failover via AMQPStreamConnection::create_connection(), and good coverage of the RabbitMQ extensions that matter operationally: publisher confirms, basic.nack, consumer cancel notify, exchange-to-exchange bindings. The README is unusually honest about constraints, which is a positive signal for evaluation: single-threaded connection model, no built-in automatic reconnection (you write the retry loop yourself), and a documented setBodySizeLimit() because oversized messages can exhaust PHP memory before your callback fires. The maintainer list — including VMware/RabbitMQ engineers — plus the project's use in the official RabbitMQ PHP tutorials gives strong confidence that protocol correctness is not a risk area.

Technical risk. The risks are concentrated in three places. First, licensing: LGPL-2.1 is generally acceptable for server-side, dynamically-loaded Composer dependencies, but if this product is ever distributed as a packaged appliance or the code base is statically bundled, legal review is warranted and should not be treated as a formality. Second, the wrapper gap: because this library provides no Laravel abstraction, the effective maturity of your integration is the maturity of whichever wrapper you choose, and wrapper packages lag Laravel major releases more often than the underlying library does. Third, operational correctness: delivery guarantees are opt-in (durable queues, persistent delivery mode, publisher confirms, manual acks). A team accustomed to Laravel's database driver, which is forgiving, can build a message-loss-prone topology without noticing.

Key questions.

  • What is the concrete message volume, peak throughput, and acceptable end-to-end latency? These determine prefetch, batch publishing, and whether we need multiple worker pools.
  • Do we require at-least-once delivery, and are consumers idempotent? Publisher confirms and manual acks are cheap to enable but only meaningful with idempotency.
  • Is Horizon a requirement? It is Redis-only; RabbitMQ means Supervisor-managed queue:work plus our own metrics, which is a real observability downgrade we should price in.
  • Who owns topology (exchanges, queues, bindings, DLX, retry/backoff queues)? Application code or infrastructure-as-code?
  • What are the PHP and Laravel versions, and is there an approved wrapper package with a compatible release?
  • Has legal signed off on LGPL-2.1 for our distribution model?
  • Why does the dataset report zero dependents when the ecosystem reality is that this is the standard? Confirm the sourcing before treating it as a signal.

Integration Approach

Stack fit. This is a near-frictionless fit at the dependency layer and a deliberate build at the framework layer. Recommended posture: adopt php-amqplib as the transport, and use a maintained Laravel queue driver wrapper for the 80% of workloads that are plain jobs. Reserve direct use of the library for the cases wrappers handle poorly — publisher confirms, batch_basic_publish(), custom exchange topology, setBodySizeLimit(), or non-blocking consumers. Keeping the library as an explicit top-level dependency rather than a purely transitive one makes version pinning and security patching our decision instead of a wrapper maintainer's.

Migration path. Laravel's queue abstraction makes this cheaper than it looks. Move in three stages: (1) introduce RabbitMQ alongside the existing driver for one non-critical queue — notifications or webhooks — so the team learns topology and worker supervision without production consequence; (2) migrate a durable-workload queue with confirms, manual acks, and a DLX configured from day one; (3) decommission the old driver per queue. Avoid a flag-day cutover; the failure modes (reconnection, unacked message redelivery, duplicate delivery on producer retry) only surface under real load, and you want them surfacing on low-stakes traffic.

Compatibility. Confirm the PHP version matrix against the pinned library release; recent releases target modern PHP and older Laravel versions may pull a wrapper that constrains the library version. Validate against the actual RabbitMQ server version and any managed offering (CloudAMQP, Amazon MQ) — managed brokers often restrict plugins, consumer_timeout behavior, and policy configuration, which changes retry semantics. AMQP 0-9-1 has been stable for years, so server upgrades are low-risk; the wrapper is the fragile link, not the protocol.

Sequencing.

  1. Legal review of LGPL-2.1 against the distribution model (blocks nothing technically, but should not be deferred).
  2. Spike: publish and consume through the chosen wrapper in a staging environment with a DLX and confirms enabled; measure throughput at target prefetch.
  3. Define topology-as-code and naming conventions before the first production queue exists.
  4. Build the consumer supervisor configuration, reconnect/backoff policy, and health/lag metrics.
  5. Migrate queues in ascending order of business criticality.

Cost note. The library itself is free; the real cost is 2–4 engineer-weeks of platform work for topology, supervision, observability, and retry semantics that a managed queue (SQS) would supply out of the box. That is a justified spend only if RabbitMQ's routing flexibility, DLX semantics, or existing infrastructure investment is actually needed.

Operational Impact

Maintenance. Upstream health is good: active maintainers with broker-vendor involvement, changelog, generated API docs, releases, and CI. The maintenance burden lands almost entirely on our code — the reconnect loop, the supervisor configuration, and the wrapper version we trail. Budget for a recurring dependency-review task: track both php-amqplib and the Laravel wrapper, and expect the wrapper to be the slower of the two to support new Laravel majors. Pin versions and test upgrades in staging; the library's changelog is the authoritative source for behavior changes.

Support. Community support only, via GitHub issues. No commercial SLA exists for the library itself, though vendor support may be available through a managed RabbitMQ provider or a RabbitMQ commercial subscription. For a business-critical message path, this means our own on-call runbook is the actual support contract — document reconnect behavior, DLX inspection, and how to safely purge or replay a queue before go-live, not after the first incident.

Scaling. Scales predictably in the horizontal direction: add worker processes, each with its own connection and channel, and tune basic_qos prefetch per worker to balance throughput against fair dispatch and memory. The library is single-threaded and blocking, so a slow consumer blocks its own process only — acceptable, provided workers are supervised and concurrency is expressed as process count. Watch three scaling ceilings: PHP memory per consumer with large message bodies (mitigate with setBodySizeLimit() and DLX routing to a large-payload consumer), connection/channel churn driving broker CPU (AMQProxy is worth evaluating), and publisher throughput (mitigate with batch_basic_publish() and message reuse).

Failure modes. Rank by likelihood and blast radius:

  • Silent consumer death — the process exits or hangs on a dropped socket and nothing restarts it. Mitigation: Supervisor with autorestart, plus lag alerting on queue depth.
  • No automatic reconnection — the library throws; our code must catch, clean up the stale connection, back off, and reconnect. Without a deliberate retry loop, consumers stop permanently after a broker restart.
  • Message loss — non-durable queues, transient delivery mode, or auto-ack combined with a crash. Mitigation: durable topology, persistent messages, publisher confirms, manual acks after successful processing.
  • Duplicate delivery — inherent to at-least-once; consumers must be idempotent or deduplicate.
  • Memory exhaustion on oversized payloads — the documented truncation path exists specifically because the library reads the body before your callback runs.
  • Broker flow control — resource alarms block publishers; without timeouts and alerting this presents as an application hang, not a queue error.

Ramp-up. The library's API is learnable in a day; the AMQP mental model — exchanges, bindings, routing keys, prefetch, ack/nack, DLX, confirms — is a one-to-two-week ramp for engineers who have only used Laravel's database or Redis drivers, because those drivers hide precisely the concepts RabbitMQ exposes. Front-load this: one engineer owns the topology and runbook, a short internal design note covers the delivery-guarantee contract, and the team practices a broker-restart drill in staging. Teams that skip that step typically discover their reconnect and idempotency gaps during their first production incident rather than before it.

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
rlacerda83/query-parser
socialdept/atp-orm
cboxdk/laravel-assistant-client
socialdept/atp-resolver
socialdept/tenant-domains
tautvydasr/blade-class-names
socialdept/color-scales
maherelgamil/controller
coleus/widgets
coleus/table
coleus/users
coleus/music
coleus/health
coleus/calendar
coleus/notes
coleus/support
coleus/settings
coleus/apps
seampact/laravel
emmyconceptng/laravel-ng-postcode