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 Builder Laravel Package

makinacorpus/query-builder

A fluent SQL query builder for PHP that lets you construct complex SELECT, INSERT, UPDATE, and DELETE queries programmatically through a clean, chainable API. Lightweight and framework-agnostic, it integrates easily into Laravel or any PHP application.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Multi-database roadmap bets. If the roadmap includes supporting more than one RDBMS (MySQL, PostgreSQL, SQLite, SQL Server) for the same product—on-prem installs, regional hosting constraints, or self-hosted/enterprise variants—a driver-agnostic builder lets the team write queries once and swap dialects rather than maintaining parallel SQL paths. This is the single most consequential decision it informs.
  • Build vs. buy for a query abstraction layer. The alternative is hand-rolling dialect adapters or standardizing on a framework-coupled builder. This package is a candidate "buy" (MIT, no cost) that should be evaluated against the cost of maintaining our own abstraction.
  • Framework coupling strategy. A recurring decision for any Laravel shop: does new code live inside Eloquent/Illuminate\Database, or in a portable layer that also runs in CLI tools, queue workers, and standalone services? This package supports the "portable layer" option, which matters most when we anticipate extracting services or sharing query logic with non-Laravel PHP components.
  • Safe dynamic query composition. For admin query tools, saved-report builders, export/ETL jobs, and filter-driven dashboards, it provides a structured composition API instead of string concatenation—a security-relevant capability (parameter binding, identifier handling) that shapes how we scope those features.
  • Testability as a roadmap enabler. Generating SQL as a inspectable artifact (without a live database) supports unit-testing data-access logic in CI, which affects how quickly we can ship reporting and integration features.
  • Prioritization input, not a mandate. With 7 stars and zero dependents, it is evidence of a category need (portable SQL building in PHP) more than evidence that this specific implementation should be adopted. Treat it as one option in a comparison set, not a default.

When to Consider This Package

Consider it when:

  • You need one query API that emits correct SQL for multiple drivers, and you are not willing to write and maintain dialect adapters yourself.
  • You have non-HTTP workloads—cron jobs, queue consumers, CLI utilities, standalone workers—that would otherwise boot an entire framework just to construct a query.
  • You want to unit-test generated SQL without provisioning a database, or you want query construction decoupled from a specific connection/ORM layer.
  • You are prototyping something small and permissive licensing (MIT) and a lightweight dependency footprint matter.

Look elsewhere when:

  • You are a committed Laravel shop and this is for application data access. Illuminate\Database is maintained by the framework, documented exhaustively, and supported by a massive ecosystem. Swapping it out for a 7-star package is a poor trade for most teams.
  • You need production reliability guarantees. Zero dependents and a single-digit star count mean effectively no external validation, no community bug-finding, and a high bus factor. There is no security response process you can rely on.
  • You need ORM features—relationships, eager loading, model events, schema/migration management, connection pooling. This is a query builder, not a data layer.
  • Your requirement is only one database engine. Driver agnosticism buys nothing if you will never run a second dialect; you are paying an abstraction tax for unused flexibility.
  • You cannot absorb maintenance. If your organization will not fork, vendor, pin, and assign an internal owner, do not adopt.

Adoption criteria if pursued: run a time-boxed spike covering your two hardest real queries across all target dialects; verify test coverage and last-commit recency; confirm the license and dependency tree; decide explicitly between "pin + vendor the source" and "fork and own it" before it reaches production.

How to Pitch It (Stakeholders)

To executives: This is a small, MIT-licensed PHP library for building SQL that works across database engines. It is relevant to one decision only: whether we commit to a single database vendor or keep the option to run on more than one. Adopting it is cheap and reversible; the risk is support—it is a low-adoption project with essentially one maintainer. Recommendation: approve a short evaluation, not a commitment. If it passes, we treat it as internal code we own, not as an external dependency we lean on.

To engineering: This gives us a driver-agnostic query API—useful for CLI tools and workers that shouldn't boot the framework, and for any future multi-dialect requirement, with the side benefit of testing generated SQL without a database. The honest caveats: near-zero adoption, no ecosystem, no security process, and it does not replace Eloquent for application data access. If we adopt, we pin the version, vendor the source, and name an owner. Otherwise we stay on the framework's builder and revisit only if a multi-database requirement actually lands on the roadmap.

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.
novasa/laravel-language-center
opencage/geocode
adolfoholzer/parameters
livenetworks/ln-starter
shitoudev/permissionmanager
johannesclimacus/laravel-tui
hocvt/seotools
vitalybaev/sypexgeo
amphibee/themosis-ignition
gito-me/fast-excel
frankyso/laravel-ipaymu
geolize-studio/laravel-chile
boomerangui/chat
cgv/localized-resource
noith/settings
kda/laravel-package
kda/filament-dynamic-navigation
bypersoft/signbox
pairus/product-data
fayne/laravel-filament-cms-core