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

Query Bus Laravel Package

gnugat/query-bus

A lightweight query bus for PHP that dispatches queries to dedicated handlers, helping decouple read operations from application code. Includes middleware support for composing cross-cutting concerns around query execution.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Evaluating build vs. buy for CQRS-style query routing in Laravel: this package offers a ready-made QueryBus with prioritized QueryMatcher registration, reducing the need to build custom dispatch logic.
  • Roadmap decisions around modularization: if the application is growing in query complexity, adopting a query bus can support future extraction of services or modules without rewriting call sites.
  • Feature decisions: use matcher prioritization to implement fallback query handlers, A/B testing of query logic, multi-tenant routing, or plugin-style query handlers—all without changing consumer code.
  • Use cases: implementing CQRS in a modular monolith, decoupling controllers from query logic, enabling deterministic handler selection when multiple handlers exist.

When to Consider This Package

  • You’re building a Laravel application that follows (or is moving toward) CQRS and needs a clean separation between query dispatch and handling.
  • You have multiple handlers for the same query and require deterministic priority (e.g., a default handler vs. a specialized or override handler).
  • You want a minimal, focused package rather than a full CQRS framework, and you value simple integration with Laravel’s service container.
  • Look elsewhere if: you need a command bus, event bus, or full CQRS/Event Sourcing framework; you rely exclusively on Laravel’s built-in service container and don’t need a query bus abstraction; or you require advanced features like middleware pipelines, async processing, or distributed tracing.

How to Pitch It (Stakeholders)

  • Executives: This package reduces technical debt by standardizing how queries are routed, making the codebase easier to maintain and scale as we add features. It’s a small, low-risk dependency that prevents us from building and maintaining custom routing logic.
  • Engineering: It provides a clean QueryBus with prioritized QueryMatcher registration, enabling flexible query handling (fallbacks, overrides, tenant-specific logic) without scattering conditionals. It integrates with Laravel’s container and can be adopted incrementally. v1.0.0 is stable and the prioritization feature is a meaningful step toward production readiness.
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.
se7enxweb/flysystem
lampwick/laravel
jeslage/statamic-emojis
micahdshackelford/rmap-laravel
draftsmaninc/draftsman
square-bit/laravel-volition
himito/laravel-mailman
htinlynn/genius-helper
maco-studios/hephaestus
elmogy/larafast
xeviant/laravel-paystack
gorilladash/laravel-website-sdk
martialbe/flysystem-oss
chondal/3312client
jeroen-g/flickr
opscale-co/nova-genbi
itsjustvita/laravel-retention
tequilarapido/trackit
gregsphotography/site-builder-filament
cabaoctavio/laravel-query-log