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.
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.Consider it when:
Look elsewhere when:
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.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.
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.
How can I help you explore Laravel packages today?