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

Messenger Laravel Package

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.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture Fit

  • Decoupling & Asynchronous Processing: 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.
  • Extensibility: Custom buses, transports, and middleware remain the primary TPM lever — retries, deduplication, failure transports, and per-message routing can be shaped without forking. New constraint: the stamp surface is now partially policed by the framework (see Technical Risk). Custom stamps must be explicitly sendable; extensibility is intact but no longer unbounded.
  • Symfony Ecosystem Synergy: Unchanged. Serializer tie-in remains relevant, and this release makes the serializer/PhpSerializer boundary a security control point rather than a style preference.
  • Stability Signal (revised): The prior assessment retired the "beta risk" caveat on the strength of the stable 8.1 patch line at 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.
  • Line-Ambiguity Flag: The release tag under review is 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.

Integration Feasibility

  • Laravel Queue System: Unchanged. Drop-in replacement, hybrid (Messenger for complex workflows, Laravel queues for simple jobs), or side-by-side workers all remain viable.
  • Transport Compatibility: Redis, AMQP (RabbitMQ), Doctrine (DB), and in-memory are supported; AMQP still requires 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.
  • Middleware Alignment: Unchanged — Laravel Retry/Throttle still map to Messenger stamps/middleware with modest glue code.
  • No New Integration Surface: No new transports, config keys, or public API. Integration effort estimates carry forward unchanged; the delta is remediation and audit work, not build work.

Technical Risk

  • Security Risk (NEW — highest priority): Three fixes in 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.
    • Exploit precondition: write access to the queue/broker, or a compromised producer service, or any shared/multi-tenant queue. Internal single-tenant Redis/Doctrine traffic where only our own workers publish is materially lower risk — but "lower" is not "none," and the fix is cheap.
  • Behavioral Change — Custom Stamps (potential breaking): If the team has authored custom stamps, any stamp that does not satisfy Messenger's sendability contract will now cause the message to be rejected at decode time. This is the most likely source of post-upgrade production breakage, and it will present as a consumption failure, not a deploy failure — the worst kind of timing.
  • Behavioral Change — Failure Diagnostics: Normalized exceptions in the failure transport will no longer carry trace arguments. Debugging depth drops for anyone currently reading args out of messenger:failed:show. Acceptable trade (prevents credential/PII spill into a UI), but support runbooks and any custom failure-queue tooling need updating.
  • Serialization Risk (escalated): The standing guidance to avoid 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.
  • Test Determinism: The InMemoryTransport DST fix from v8.1.8 remains valid and is unaffected by this release.
  • Risk Posture Change: Upward on security, downward on stability. Net: the 8.1 line is still the right home, but the version floor is now provisional pending confirmation of the 8.1 backport.

Key Questions for the TPM

  1. Patch-Level Mapping (blocking): Which 8.1.x release contains the equivalent of #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.
  2. Exposure Model: Who can write to each queue? Is any broker shared across teams, exposed beyond the VPC, or fed by services we don't own? This determines whether remediation is a 24-hour or 7-day item.
  3. Custom Stamp Inventory: Do we ship any custom stamps? Are they sendable? Does any handler or consumer read X-Message-Stamp-* headers directly?
  4. Serialization Policy (now non-negotiable): Commit to JSON/symfony/serializer for anything crossing a service or trust boundary. PhpSerializer is for internal, single-tenant traffic only.
  5. Failure-Observability Delta: Do we depend on exception trace arguments in the failure transport or any admin panel? If so, where do we recover equivalent diagnostics, and how do we redact them?
  6. Transport Strategy: Which transports are in use, and does the AMQP/header surface materially widen our exposure?
  7. Upgrade Policy: Who watches Symfony security advisories, what is the SLA for a [SECURITY] patch, and does the pipeline rebuild worker images — not just bump composer.json?
  8. Team Readiness: Unchanged — 1–3 sprints of ramp for Symfony-bus-naive Laravel teams, front-loaded on serialization and retry semantics.

Integration Approach

Stack Fit

  • Laravel Compatibility: Unchanged. Redis/Doctrine transports remain compatible with existing queue configuration; AMQP still requires extra bundle setup.
  • Symfony Integration: Unchanged. A thin service provider registering MessageBus as a Laravel singleton remains the bridge pattern.
  • Queue Workers: 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.
  • Version Constraint (revised): Keep "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.

Migration Path

  1. Phase 0 (NEW): Patch & Audit — Establish the 8.1 backport version; pin it; rebuild worker images; inventory custom stamps and any X-Message-Stamp-* header consumers; confirm JSON/Serializer policy for cross-boundary messages.
  2. Phase 1: Pilot — Non-critical feature (e.g., report generation), Redis transport, explicit failure/retry testing. Run on the patched floor so the pilot exercises the new stamp validation.
  3. Phase 2: Hybrid — Message Bus Adapter translating Laravel jobs to Messenger 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.
  4. Phase 3: Full Adoption — Migrate remaining jobs, replace Laravel listeners with Messenger handlers, deprecate legacy job classes.
  5. Phase 4: Advanced — AMQP for high-throughput paths, deduplication/idempotency middleware, observability integration.

Sequencing gains a mandatory Phase 0. Everything downstream is unchanged in shape; the ordering of remediation before expansion is the substantive change.

Compatibility

  • Laravel Queue System: Redis/Database transports directly compatible; custom queues need adapters.
  • Middleware Mapping: Unchanged — RetryAfterFailure → RetryStamp, ThrottleJobs → custom middleware, SkipOnFailedJobs → RecoverableMessageHandlingException.
  • Serializers: 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.
  • Stamps & Headers: Custom stamps must satisfy the sendability contract. Header-sourced stamps (X-Message-Stamp-*) are now restricted; any integration relying on rich header payloads must be re-tested, and AMQP consumers re-validated first.
  • Failure Transport: Envelope normalization no longer includes exception trace arguments — downstream tooling that parses them must be adjusted.
  • Service Container: Unchanged — register MessageBus as a Laravel singleton via a service provider.
  • Test Transport: InMemoryTransport remains safe for delayed-message assertions at the DST-fixed floor; unaffected by this release.

Sequencing

  1. Advisory Triage — Map #66509 / #65693 / #65746 to 8.1.x; classify exposure by queue trust model.
  2. Patch Rollout — Bump lock file, rebuild worker images, supervise messenger:consume restart; drain and restart consumers so no old-code worker keeps decoding.
  3. Stamp & Header Audit — Run a full consumer replay against a staging broker seeded with the production message shapes before cutover.
  4. Code-Level Changes — Job → message classes, handlers implementing Messenger's handler contract.
  5. Worker Deployment — messenger:consume alongside queue:work, supervised via systemd/Supervisor.
  6. Testing — Serialization round-trips, poison-pill/retry scenarios, load tests, DST-boundary delayed-message cases, and negative tests that malformed/smuggled stamps are rejected rather than crashing consumers.
  7. Rollback Plan — Dual-write during migration; keep critical paths on Laravel queues until Messenger paths are proven. For the security patch itself, rollback is not an option — forward-fix only.

Operational Impact

Maintenance

  • Release Cadence (revised): Two distinct cadences to staff. The 8.1 line is patch-only (low churn, monthly review). Security backports to maintained older lines (5.4, 6.4, 7.x) will continue to appear and must be read as signals about our own branch, even when the tag is not one we run.
  • Security Patch SLA: Define one. Recommended: 24–48 hours for queues writable by other services or reachable outside the VPC; 7 days for strictly internal single-tenant brokers. Assign an owner for Symfony security advisories and a documented path from advisory → lock bump → image rebuild → consumer drain.
  • Dependency Management: Messenger is actively maintained; the residual risk is divergence between Symfony's release train and Laravel queue internals, not instability in Messenger. Track Symfony 9.x for breaking changes.
  • Configuration Drift: Centralize transport DSNs in .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.
  • Logging: Bridge Messenger's CLI logging into Laravel Monolog so ops has one log surface — and note that trace-argument detail is now reduced at normalization time, so log-side capture (with redaction) may be the only place to recover it.

Support

  • Debugging: 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.
  • New Incident Class to Document: "Message rejected on decode." Post-patch, a non-sendable stamp or a restricted header surfaces as a rejected message rather than a processed one. Support needs a triage branch for this: is this (a) a legitimate malicious/malformed payload being correctly blocked, or (b) our own custom stamp failing the new contract?
  • Incident Classes to Document: poison messages, serialization failures on deploy skew, worker starvation, DST-adjacent delayed-message behavior, and the new decode-rejection class above.
  • Runbook Addition: Consumer drain/restart during a security patch, so no unpatched worker continues decoding from the broker.

Scaling

  • Horizontal scaling via additional 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.
  • Scaling vs. Security Trade-off: Stamp validation adds a per-message decode cost. Expected to be negligible against serialization cost, but worth a benchmark on the highest-volume path rather than an assumption.
  • No scaling characteristics changed in this release.

Failure Modes

  • Transport-level: broker unavailability, DSN misconfiguration, credential rotation.
  • Message-level: poison pills (mitigated by failure transport + retry stamps), deserialization errors on version skew, duplicate delivery (requires handler idempotency), and decode rejection of non-sendable/unsanctioned stamps (new).
  • Security-level: queue write access by an unauthorized or compromised producer, header injection on AMQP/HTTP transports, credential or PII leakage via normalized exception traces (mitigated).
  • Clock-level: delayed-message correctness around DST transitions — addressed for InMemoryTransport at the earlier patch floor (test surface only); production transports rely on broker clock semantics and should still be validated.
  • Deploy-level: old workers consuming new message shapes. Mitigation: additive message evolution, draining strategy, and mandatory worker-image rebuild on security patches.

Ramp-Up

  • Effort: Unchanged for the core architecture — 1–3 sprints for a Laravel-fluent team new to Symfony buses, front-loaded on serialization, retry semantics, and worker ops. Add a few days for the security remediation cycle and stamp audit.
  • Cheapest First Win (revised): The first win is no longer the pilot — it is remediation. Confirm the 8.1 patch level, bump the floor, rebuild worker images, and drain consumers. That is a same-week, low-risk change that removes an actively-fixed vulnerability class from the stack.
  • Updated Recommendation: The prior "adopt ^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.
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.
steadrun/laravel-monitor
labyrinthe/connect-laravel
elmogy/layan
drewdan/sentinel-client
dskripchenko/laravel-llm
fatryst/nuonuo
stevenay/myanfont
gmostafa/php-graphql-client
xeviant/paystack
snowsoft/faker
meditationsteps/blogetc
animalyoung/laravel-influxdb
onix-solutions/sms-telera
lonely-lights/prosetta
oxygen/data
oxygen/core
jengo/base
xiloryx/log-collector
a21ns1g4ts/filament-stripe
la-php/laravel-admin