symfony/messenger
Symfony Messenger helps PHP applications send and receive messages to and from other applications or message queues. It offers transports, middleware, and message handlers for building scalable, asynchronous, event-driven systems, and integrates smoothly with Symfony or standalone PHP projects.
symfony/messenger remains a strong architectural fit for Laravel applications needing background jobs, event-driven workflows, or service-to-service messaging. Transport support (Redis, AMQP, Doctrine, in-memory/sync) and the bus/middleware model are unchanged by this release.PhpSerializer boundary a security control point rather than a style preference.v8.1.8. That conclusion stands, but the security posture now supersedes the stability posture as the dominant consideration. A [SECURITY] release has shipped on the 5.4 line (v5.4.54); the 8.1 line is only safe if an equivalent fix has landed there. Version floor must be re-verified before the "adopt in production" recommendation can be re-affirmed.v5.4.54, not an 8.1 patch. This is almost certainly a backport to a security-maintained older branch. The TPM should not treat "a security fix exists" as "our pinned version is fixed" — the mapping between the advisory and the 8.1 patch level is the single most important fact to establish this cycle.symfony/amqp-messenger. AMQP is the transport most exposed by this release — #65693 restricts X-Message-Stamp-* headers, which are a header-based transport concern.Retry/Throttle still map to Messenger stamps/middleware with modest glue code.v5.4.54 close an envelope/deserialization trust boundary:
#66509 — decoded messages carrying non-sendable stamps are now rejected, and stamps on unserialized envelopes are validated. This is the critical fix: the unserialize path could previously be induced to materialize objects supplied by whoever could write to the queue or broker.#65693 — restricts what X-Message-Stamp-* headers can place into an envelope. Anyone able to publish to an AMQP/HTTP-backed queue, or to inject headers, had a writable channel into envelope construction.#65746 — drops trace args from FlattenException normalization, reducing the chance of secrets/PII from call arguments leaking into the failure transport, logs, or an admin UI.messenger:failed:show. Acceptable trade (prevents credential/PII spill into a UI), but support runbooks and any custom failure-queue tooling need updating.PhpSerializer across trust boundaries is now enforced rather than advisory. This should be treated as a policy decision the TPM owns, not a developer preference.InMemoryTransport DST fix from v8.1.8 remains valid and is unaffected by this release.#66509, #65693, and #65746? v5.4.54 does not satisfy an ^8.1 constraint. No production sign-off until the 8.1 floor is pinned to a build containing these fixes.X-Message-Stamp-* headers directly?symfony/serializer for anything crossing a service or trust boundary. PhpSerializer is for internal, single-tenant traffic only.[SECURITY] patch, and does the pipeline rebuild worker images — not just bump composer.json?MessageBus as a Laravel singleton remains the bridge pattern.queue:work extended for Messenger buses, or messenger:consume alongside it. Note: worker images must be rebuilt to pick up the patched package — a container tag bump is required even where only composer.lock moved."symfony/messenger": "^8.1", but the lock floor is now >= 8.1.x where x is the first release containing the v5.4.54 equivalents. Do not restate >=8.1.8 as sufficient until the advisory mapping is confirmed.X-Message-Stamp-* header consumers; confirm JSON/Serializer policy for cross-boundary messages.$message = new AsyncTaskMessage($job->payload);
$bus->dispatch($message);
Verify every message class and custom stamp passes the new sendability validation before wiring adapters broadly.Sequencing gains a mandatory Phase 0. Everything downstream is unchanged in shape; the ordering of remediation before expansion is the substantive change.
RetryAfterFailure → RetryStamp, ThrottleJobs → custom middleware, SkipOnFailedJobs → RecoverableMessageHandlingException.PhpSerializer remains usable for internal traffic, but the decode path now rejects non-sendable stamps and validates unserialized envelope stamps. Prefer symfony/serializer with JSON for cross-service or untrusted traffic — this is now a hard recommendation, not a preference.X-Message-Stamp-*) are now restricted; any integration relying on rich header payloads must be re-tested, and AMQP consumers re-validated first.MessageBus as a Laravel singleton via a service provider.InMemoryTransport remains safe for delayed-message assertions at the DST-fixed floor; unaffected by this release.#66509 / #65693 / #65746 to 8.1.x; classify exposure by queue trust model.messenger:consume restart; drain and restart consumers so no old-code worker keeps decoding.messenger:consume alongside queue:work, supervised via systemd/Supervisor..env (MESSENGER_TRANSPORT_DSN), define routing in config/packages/messenger.yaml, keep failure transports explicit. Add a check that serialization mode is explicit per transport, not inherited by default.messenger:consume --time-limit=... plus messenger:failed:show / messenger:failed:remove remain the triage path; there is still no Horizon-equivalent UI. A small Laravel admin panel over the failure transport remains the pragmatic answer — and must now be reviewed so it does not depend on trace args that no longer arrive.messenger:consume workers remains the lever; Redis and AMQP scale out cleanly. Serialization overhead remains the throughput ceiling — prefer JSON and consider batching or AMQP over the DB transport for high-volume paths.InMemoryTransport at the earlier patch floor (test surface only); production transports rely on broker clock semantics and should still be validated.^8.1 in production for new async workloads" posture is conditionally maintained, gated on the 8.1 backport being confirmed and pinned. Treat PhpSerializer across any trust boundary as prohibited. Keep the hybrid adapter for existing Laravel jobs until the Messenger path has a full quarter of failure-rate data — and extend the observation window by one release cycle to capture any decode-rejection fallout from the new stamp validation.How can I help you explore Laravel packages today?