Weave Code
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

Laravel Querybuilder Laravel Package

ghostcompiler/laravel-querybuilder

API-ready Eloquent query builder for Laravel with strict allow-lists for filters, sorts, includes, and sparse fields. Supports nested relation filters/sorting, custom filters, tenant scoping, safe public query interfaces, and pagination helpers for clean API responses.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • API Standardization: Enables consistent, schema-driven query handling across all Eloquent-based APIs, reducing ad-hoc query logic and improving maintainability.
  • Security Hardening: Shifts from permissive to strict query validation (e.g., rejecting unknown filters/sorts), mitigating injection risks and unintended data exposure.
  • Developer Velocity: Accelerates API development by providing reusable, battle-tested query builders for common patterns (e.g., nested relations, pagination, sparse fieldsets).
  • Roadmap Alignment: Supports future-proofing for Laravel 10–13, reducing migration friction if adopting newer versions.
  • Build vs. Buy: Justifies buying this package over custom solutions for teams lacking query-building expertise or needing rapid, secure API rollouts.
  • Use Cases:
    • Public APIs (e.g., JSON:API compliance with strict query validation).
    • Internal admin dashboards with complex filtering (e.g., multi-tenant, nested relations).
    • Microservices requiring consistent query interfaces across services.

When to Consider This Package

  • Adopt When:

    • Your Laravel APIs handle dynamic query parameters (filters, sorts, includes) and need explicit allow-listing for security.
    • You’re building public APIs or need JSON:API compliance with strict validation.
    • Your team lacks dedicated query-building expertise or wants to avoid reinventing wheels for common patterns (e.g., pagination, sparse fieldsets).
    • You require tenant-aware scoping or policy-aware relation includes out of the box.
    • Your roadmap includes Laravel 10–13 and you want to future-proof query logic.
  • Look Elsewhere If:

    • Your queries are static (no dynamic filtering/sorting) → Overkill for simple CRUD.
    • You need advanced full-text search → Consider dedicated packages like spatie/laravel-searchable.
    • Your team prefers flexible, dynamic query building over schema-driven constraints → Evaluate beberlei/assert or custom solutions.
    • You’re using non-Eloquent data sources (e.g., raw SQL, external APIs) → Not applicable.
    • Your stack is pre-Laravel 10 or PHP <8.1 → Incompatible.

How to Pitch It (Stakeholders)

For Executives:

"This package lets us build secure, scalable APIs faster by enforcing strict query rules—blocking malicious or invalid requests before they hit our database. It’s like a ‘firewall for API queries,’ reducing security risks while standardizing how our teams build APIs. For example, we can roll out a new admin dashboard with complex filtering in weeks, not months, while ensuring only approved fields/sorts are exposed. The MIT license and active maintenance (last release: June 2026) make it a low-risk bet."

For Engineering:

*"Problem: Our APIs have inconsistent query handling—some use raw where() clauses, others rely on ad-hoc request parsing, and security gaps exist (e.g., arbitrary field selection). Solution: This package gives us:

  • Schema-driven queries: Define allowed filters/sorts once, enforce everywhere.
  • Security by default: Rejects unknown queries (e.g., ?sort=password fails fast).
  • JSON:API readiness: Supports sparse fieldsets, nested includes, and strict validation.
  • Tenant safety: Built-in scoping for multi-tenant apps. Tradeoff: Slight learning curve for schema setup, but pays off in maintainability and security. Alternatives: Custom solutions or permissive packages like spatie/laravel-query-builder (but those lack strict validation)."*

Key Selling Point: "It’s the difference between ‘Does this query work?’ and ‘Is this query safe and performant?’—automatically."

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.
terminal42/code-quality-tools
codifyo/ts-generator-bundle
andydefer/laravel-cluster
testo/fiber
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity
christhompsontldr/laravel-inky