sigbits/php-amqp-client-bundle
A Symfony bundle that integrates the php-amqp client, providing service configuration and convenient dependency injection for publishing and consuming AMQP messages. It streamlines connection setup so Symfony applications can wire AMQP exchanges, queues, and consumers with minimal boilerplate.
composer require sigbits/php-amqp-client-bundle:^0.7. The baseline now pulls sigbits/php-amqp-client:^1.4, requires PHP ^8.3, and targets Symfony ^6.4 || ^7.4 || ^8.1.config/amqp.php. If your app is Laravel, the bundle's autoconfiguration will never run — the day-to-day value you get is from the underlying sigbits/php-amqp-client 1.4 APIs plus whatever you wire yourself. If you are on Symfony, register the bundle in bundles.php and start with the DI extension to see what services it exposes.OpenReceiverEndpoint (consuming) and TerminusFactoryInterface (producing / settling). In 0.7.0 these gained deliveries() and modified() respectively, and those are exactly the APIs you will touch most.Consuming with deliveries(). The new iterator is the idiomatic consume loop in 0.7.0:
$endpoint = $container->get(OpenReceiverEndpoint::class);
foreach ($endpoint->deliveries() as $delivery) {
try {
$this->handle($delivery->message());
$endpoint->accept($delivery);
} catch (RetryableException $e) {
$endpoint->release($delivery);
} catch (\Throwable $e) {
$endpoint->reject($delivery);
}
}
Treat the iterator as infinite — it is a long-running loop, not a finite collection. Wrap it in a worker command with signal handling so SIGTERM breaks out cleanly.
Settling with modified(). TerminusFactoryInterface::modified() lets you return a modified outcome instead of a hard reject. This is the right tool when you want to release a message back to the broker without counting it as a failure — for example "this consumer cannot handle this routing key right now" or "dependency unavailable, put it back". Use it deliberately:
accept — processed, drop it.reject — permanent failure, dead-letter it.release — transient failure, redeliver.modified — "not my message / not now", with delivery-failure and requeue flags.Laravel wiring. Since bundling doesn't apply, bind the client in a service provider as a singleton connection, and expose the endpoint via the container. Keep the connection out of the request lifecycle and instead resolve it inside a queued job or a custom Artisan worker command — that mirrors what the Symfony bundle does with its long-lived services.
Producing. Resolve the terminus factory from the container rather than constructing it inline; you want one factory per connection so delivery-state values and the connection's session stay consistent.
Testing. The endpoint/factory pair is interface-driven (TerminusFactoryInterface), so fake the factory in unit tests and use a real broker (Testcontainers / a compose service) for a thin integration suite. Do not try to unit-test the iterator.
0.7.x is a minor bump that raised a hard dependency floor and added APIs. Expect 0.x minors to break things — pin to ^0.7 and read every changelog, or pin exactly. The 0.7-dev branch alias means dev-* constraints will now resolve differently in CI.^1.4 floor is a conflict source. If anything else in the tree pins sigbits/php-amqp-client to 1.3.*, Composer will fail the whole install. Check composer why sigbits/php-amqp-client before upgrading rather than after.platform config in composer.json must agree, or you get a confusing resolution failure that looks like a package problem.services.yaml conventions apply. They don't. Everything is manual wiring: connection, factory, endpoints.modified is not universally supported the way accept/reject are. Verify against your actual broker version in staging; a modified that the broker downgrades to a requeue can silently produce a hot redelivery loop.deliveries() yields ten messages and your worker crashes on the third, everything unacked is requeued — which is correct, but makes non-idempotent handlers dangerous. Make handlers idempotent before you enable prefetch above 1.How can I help you explore Laravel packages today?