mouf/magic-query
Magic Query lets PHP developers describe SQL queries in JSON instead of hand-written strings, then compiles them into parameterized SQL with joins, unions and filters handled automatically. This reduces injection risk and makes complex queries easier to build, reuse and maintain across projects.
IN, optional date ranges. A package like this discounts those epics from "weeks of query-builder plumbing" to "adapter + tests."IN lists, optional filters). That's a defensible line item in a security review, not just a dev-experience win.IN expansion, tuple IN for multi-column matching, conditional/optional predicates — is a useful spec to measure Laravel's whereIn / when() against before we decide to write our own.QueryCompiler interface, which makes "adopt now, swap later" a low-regret decision rather than a lock-in.Consider it when:
IN / multi-column matching and want it parameterized rather than interpolated.Look elsewhere when:
whereIn, when(), and conditional clauses cover the large majority of cases with zero new dependency and zero new concepts.Net: viable for a bounded, filter-heavy subsystem behind an interface; not viable as a foundation for general data access.
Executives: "We repeatedly write fragile SQL string-building for filter-heavy screens — search, reporting, exports. This is a small, maintained library that produces safe, parameterized SQL for any number of filters, which cuts both injection risk and delivery time on those features. It's cheap to trial because we'd put it behind an interface, so reversing the decision later is contained."
Engineering: "Framework-agnostic SQL compiler. Input: SQL with named placeholders plus a param bag where values may be arrays or optional. Output: SQL text plus bound params for PDO — giving us IN expansion, tuple IN, and conditional predicates without string concatenation. Not Laravel-native: no service provider, no facade; we'd add a thin adapter over DB::select and own the tests. Adoption signal is low (20 stars, 0 dependents, one vendor), so we gate it behind the interface, run a one-sprint spike on one reporting endpoint, and only broaden if it holds up."
How can I help you explore Laravel packages today?