- What is zing/laravel-query-builder used for?
- zing/laravel-query-builder is a lightweight Laravel package for composing Eloquent queries from request query-string parameters such as filters, sorts, includes, and pagination. It helps move query-shaping logic out of controllers into a declarative, testable layer. It is aimed at APIs and admin panels that expose collection endpoints backed by Eloquent.
- How do I install zing/laravel-query-builder?
- Install it with Composer, optionally publish its configuration, and declare allowed filters, sorts, and includes per model or per controller. Integration is usually one middleware or builder invocation plus per-endpoint allowlists. The evaluation estimates a single engineer can spike it against a non-critical read endpoint in under a day.
- Which Laravel and PHP versions does zing/laravel-query-builder support?
- The technical evaluation positions it for Laravel 9+ on PHP 8.1+, but you should verify the illuminate/support and illuminate/database constraint ranges in composer.json against your target Laravel version. Because this is a low-traffic package, framework-major support may lag. Pin an exact minor version and confirm compatibility before planning an upgrade.
- Is zing/laravel-query-builder a good alternative to spatie/laravel-query-builder?
- It occupies the same request-to-Eloquent niche as spatie/laravel-query-builder, which has orders of magnitude more usage and ecosystem validation. Adopting zing/laravel-query-builder needs a stated reason such as a specific feature, API shape, or dependency constraint. For greenfield work, run a written feature-matrix bake-off against the incumbent before committing.
- How does zing/laravel-query-builder handle invalid filter or sort parameters?
- This is a key item to confirm before production use: check whether filters, sorts, and includes are allowlist-only by default and whether unknown parameters are rejected with 400 or 422 rather than silently ignored. Query-string-driven builders can otherwise expose unvalidated column names or relation paths to SQL identifier positions. Add endpoint tests that assert the behavior you expect for unknown and disallowed parameters.
- Is zing/laravel-query-builder safe for production use?
- The dominant risk is adoption validation: the package has roughly 4 stars and 0 dependents, so there is little third-party production usage, Stack Overflow coverage, or blog guidance to learn from. It also has a bus factor of one, meaning abandonment risk is mitigated mainly by your willingness to fork under the MIT license. Treat it as a candidate for a non-critical endpoint spike first, not an automatic production default.
- How do I test query filtering built with zing/laravel-query-builder?
- The package’s main architectural benefit is pushing query shaping into a declarative, testable layer instead of hand-rolled request conditionals in controllers. Write feature tests that call collection endpoints with representative query strings and assert the returned JSON and underlying database constraints. Confirm PHPUnit or Pest compatibility for your Laravel and PHP matrix before standardizing on it.
- Does zing/laravel-query-builder support relationship includes?
- The package is described around filters, sorts, includes, and pagination, but you should verify how relation includes work in practice. Confirm whether includes support per-relation constraints and whether the package guards against unbounded include depth. Allowlist relation names explicitly and avoid exposing arbitrary relationship paths from request input.
- Is zing/laravel-query-builder actively maintained?
- The evaluation flags a single maintainer, very low star count, and zero dependents, so maintenance signals need scrutiny. Confirm the release cadence, breaking-change history, CI matrix across supported PHP and Laravel versions, and whether the listed 2026-03-18 release date is real rather than a metadata artifact. Also check for a documented security policy and a private issue-reporting path.
- How do I migrate from spatie/laravel-query-builder to zing/laravel-query-builder?
- Do not rip out an existing spatie/laravel-query-builder integration, because differences in parameter naming, allowlist semantics, and error handling can surface as silent API contract changes. For brownfield applications, restrict zing/laravel-query-builder to new endpoints behind an internal interface. For greenfield projects, evaluate it against the incumbent on a written feature matrix before adopting it broadly.