- How do I install php-amqplib in a Laravel project?
- Install it with Composer using the package name videlalvaro/php-amqplib, for example composer require videlalvaro/php-amqplib:^3.7.5. Explicitly pinning the version is recommended for stability. The library requires the pcre and sockets PHP extensions and a running RabbitMQ server. It is framework-agnostic, so Laravel does not need any special installation step beyond resolving it through the service container.
- Is php-amqplib compatible with Laravel 11 and PHP 8.5?
- PHP 8.5 support was introduced in v3.7.4 and is unchanged in v3.7.5, so the package remains forward-compatible with modern PHP runtimes. It stays compatible with Laravel's service container and can still replace or extend Illuminate\Queue\AmqpConnector. Test with Laravel 11 or later and verify there are no breaking changes in type hints or deprecations on PHP 8.5. This is a low-risk area, but running your test suite on the target PHP version is still recommended.
- Can php-amqplib be used as a Laravel queue driver?
- php-amqplib is not a drop-in Laravel queue driver on its own, but it can replace or extend Illuminate\Queue\AmqpConnector when you need a pure PHP AMQP implementation. Many teams use it directly for custom pub/sub, fanout exchanges, delayed messages, and background job orchestration alongside Laravel's queue system. This is useful when ext-amqp is unavailable or when you need lower-level control over RabbitMQ features such as publisher confirms and exchange-to-exchange bindings.
- Does php-amqplib support publisher confirms and basic.nack?
- Yes, the library supports RabbitMQ extensions including publisher confirms, basic.nack, consumer cancel notify, and exchange-to-exchange bindings. These features let you build reliable publishing and consumption flows where message delivery is acknowledged and failures are handled explicitly. Extensions that modify existing methods, such as alternate exchanges, are also supported.
- What changed in php-amqplib v3.7.5 and is it a breaking release?
- v3.7.5 is a patch release with no API, protocol, or architectural changes, so it should not break existing integrations. It includes a heartbeat child-process fix so the SIGHeartbeatSender process exits when orphaned, removing a source of leaked or zombie processes on worker restarts and deploys. It also allows phpseclib/phpseclib v4 alongside v3, which affects TLS backend resolution on the next Composer update. The test suite now declares durable queues so it runs against RabbitMQ 4.3 and later.
- How do I configure AMQPS TLS with php-amqplib and phpseclib v4?
- Since v3.7.5 the Composer constraint admits phpseclib v4 alongside v3, so the TLS and crypto backend used for AMQPS connections can silently change major version on a routine composer update. Pin the phpseclib major version explicitly in composer.json if you need stable TLS behavior. After any version shift, re-run TLS handshake, certificate-chain, and client-auth tests in staging to validate certificate verification end to end.
- Why does my php-amqplib consumer leave orphaned heartbeat processes?
- Earlier versions could leave the SIGHeartbeatSender child process running when the parent was orphaned, which is especially visible in containerized or rolling-deploy environments with supervisor-managed consumers. v3.7.5 fixes this by making the heartbeat child exit when orphaned. To confirm the improvement and catch regressions, monitor PID counts per queue host and container PID limits. This reinforces the package's suitability for long-running consumers.
- Is php-amqplib compatible with RabbitMQ 4.3 and newer?
- The v3.7.5 test suite now declares durable queues so it runs against RabbitMQ 4.3 and above, which is an implicit compatibility signal for teams on the 4.x line. The AMQP 0-9-1 protocol changes very infrequently, so server upgrades usually do not require application code changes. If you upgrade RabbitMQ, make sure your own queue declarations use durable and auto_delete flags consistent with the package's test expectations. Always test against your target server version before upgrading production.
- How should I handle connection failures, retries, and errors with php-amqplib in production?
- Connection management and error handling are high-risk areas, so resolve the client through Laravel's service container and implement retry logic around connection establishment. Wrap AMQP operations in try-catch blocks and log failures to Laravel's log channel so transient broker issues are visible. Run consumers under a process supervisor and monitor process counts per queue host. Benchmark performance against Laravel's other queue drivers if throughput is a concern.
- What are the alternatives to php-amqplib for Laravel and RabbitMQ?
- enqueue/amqp-lib is an amqp interop compatible wrapper around php-amqplib that can simplify abstraction and testing. AMQProxy is a proxy library that provides connection and channel pooling, reducing connection churn when using php-amqplib. Laravel's native queue support typically relies on the ext-amqp extension, so php-amqplib remains the main pure PHP option. Compare them on required PHP extensions, TLS requirements, and how much low-level RabbitMQ control you need.