exyplis/eloquent-builder-macros
This Laravel package adds reusable macros to Eloquent’s query builder, making common filtering, ordering, and query-building tasks shorter and more expressive. Keep models and repositories cleaner by replacing repetitive query code with handy, chainable macros.
whereLike, whereAny/orWhere groups, date-range and whereBetween filters, conditional when() chains, sorting helpers. The product value is time saved building filter bars, search endpoints, and reporting screens, not new user-facing capability.App\Support\QueryMacros and register in AppServiceProvider. Buying introduces a dependency for code you could own outright.whereAny, whereAll, whereNone, whereLike in recent versions) already provides much of this, which weakens the case for a third-party layer.composer.json" decision.Consider it when:
whereAny/whereLike helpers and want those ergonomics now.Look elsewhere when:
require.spatie/laravel-query-builder) or write an explicit allowlist layer. Macro packages do not solve request-to-query safety.LIKE escaping, case sensitivity, SQL dialect differences) are exactly where bugs hide. Undocumented sugar in a query layer is a debugging tax on the next engineer.Recommended path: copy the macros you actually use into first-party code, cover them with a handful of query-assertion tests, and skip the dependency. Keep the composer entry only if the author ships tagged releases and you want upstream fixes — which, at present, there is no evidence of.
To executives: "This is a small utility library that makes database queries slightly faster to write. It has no adoption, no maintainers of record, and no user-visible impact. Recommendation: do not add it as a dependency; if a team wants the helpers, we spend half a day writing them ourselves and own them permanently. Cost of the decision either way is negligible — the value is avoiding an unmaintained third-party link in our stack."
To engineering: "It's a service provider that registers Eloquent builder macros — read it in ten minutes. Two concerns: (1) macro name collisions are global and silent, so namespace anything we adopt with a prefix; (2) several of these now duplicate native whereAny/whereLike, so check the Laravel version matrix first. Proposal: lift the two or three macros we actually use into App\Support\QueryMacros, add query-assertion tests, and move on. If we do take the dependency, pin it exactly and add it to the quarterly dependency review."
To design/QA: "No customer-facing behavior changes. Query results should be identical; the only test surface is that filters return the same rows and respect null and empty-string semantics the same way the current code does."
How can I help you explore Laravel packages today?