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

Query Builder Parser Laravel Package

timgws/query-builder-parser

Parse jQuery QueryBuilder rules into safe Laravel query builder constraints. Whitelist allowed fields, then generate SQL (Illuminate/Database) or MongoDB queries (via jenssegers/mongodb). Works well with tools like jQuery DataTables for advanced filtering.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Accelerate Feature Delivery for Data-Centric Products:

    • Admin Dashboards: Rapidly implement complex filtering for user management, order tracking, or content moderation (e.g., "Show inactive users with orders over $1,000 in the last 30 days").
    • Self-Service Analytics: Enable non-technical teams to build custom reports via a UI (e.g., sales teams filtering CRM data by region and date range).
    • APIs for Modern Frontends: Seamlessly integrate React/Vue datatables with Laravel backend filtering, reducing frontend-backend synchronization overhead.
    • Legacy System Modernization: Replace hardcoded SQL in older Laravel apps (5–11) with maintainable, dynamic queries, reducing technical debt.
  • Roadmap Alignment with Laravel’s Evolution:

    • Laravel 12/13 Compatibility: Zero migration risk; aligns with Laravel’s latest LTS versions, ensuring long-term viability.
    • Multi-Database Support: Unifies query logic for SQL (Eloquent/QueryBuilder) and MongoDB (via jenssegers/mongodb), critical for hybrid architectures (e.g., user profiles in SQL, logs in MongoDB).
    • Performance Optimizations: Leverages Laravel’s latest query builder enhancements (e.g., Laravel 13’s improved query caching) without custom overhead.
  • Build vs. Buy Decision:

    • Buy: Ideal for teams using jQuery QueryBuilder or similar UIs, replacing ~500–1,000 lines of custom SQL parsing logic per feature. Cost: $0 (MIT license) vs. 2–4 weeks of dev time to build equivalent functionality.
    • Custom Build: Justified only if:
      • Your queries require unsupported SQL syntax (e.g., recursive CTEs, advanced window functions).
      • You need runtime query validation (e.g., dynamic column existence checks).
      • Your frontend uses a non-compatible query UI (e.g., AG Grid, Tabulator).
    • Strategic Fit: Perfect for MVPs, admin panels, or reporting tools where speed to market outweighs customization needs.
  • Use Cases (Prioritized by Impact):

    1. Admin Panels: Dynamic filtering for users, orders, or logs (e.g., "Active users with orders > $100 in Q3 2024").
    2. APIs for Frontend Apps: Parse jQuery QueryBuilder rules into Eloquent queries for React/Vue datatables.
    3. Legacy System Refactoring: Replace spaghetti SQL in Laravel 5–11 apps with maintainable, dynamic queries.
    4. MongoDB Integration: Use the same UI for SQL and NoSQL queries (e.g., hybrid systems with user profiles in SQL and logs in MongoDB).
    5. Compliance/Reporting: Generate audit-ready queries with consistent formatting (e.g., LIKE '%term%').

When to Consider This Package

Adopt If:

  • Your primary backend is Laravel 12/13 (or you’re upgrading soon) and you use Eloquent/QueryBuilder.
  • You need to integrate jQuery QueryBuilder (or a compatible UI) with backend queries without manual SQL parsing.
  • Your team prioritizes developer velocity for:
    • Filterable data tables (e.g., admin panels, dashboards).
    • Self-service reporting tools for non-technical users.
    • APIs that accept dynamic query parameters from frontends.
  • You require multi-database support (SQL + MongoDB) with a single codebase.
  • Your risk tolerance allows for MIT-licensed, community-maintained packages with recent updates (last release: 2026-05-07).
  • You’re using Laravel 5.5+ (supports up to Laravel 13; older versions require minor adjustments).

Look Elsewhere If:

  • You’re not using Laravel/Eloquent (though Illuminate/Database support exists, it may require extra configuration).
  • Your queries require highly custom SQL syntax (e.g., recursive CTEs, advanced window functions) beyond the package’s scope.
  • You need real-time query validation (e.g., runtime column existence checks or dynamic schema introspection).
  • Your frontend uses alternative query UIs (e.g., AG Grid, Tabulator, or custom-built solutions) with incompatible APIs.
  • Security/compliance policies mandate whitelisting all possible queries at runtime (this package parses queries at build time).
  • You’re using Laravel < 5.5 (last officially supported version: Laravel 5.5; newer versions require minor adjustments).

How to Pitch It (Stakeholders)

For Executives:

*"This package eliminates a major bottleneck in building dynamic data interfaces—manually parsing frontend query rules into backend SQL. By adopting it, we can:

  • Cut development time for filters/search by 50% (e.g., admin panels, reporting tools), accelerating feature delivery.
  • Enable self-service analytics for business teams, reducing dependency on engineering and improving agility.
  • Future-proof our Laravel stack with Laravel 12/13 support, ensuring no technical debt from version upgrades.

Key Benefits:

  • Plug-and-play: Works with jQuery QueryBuilder (or similar UIs) to auto-generate SQL/MongoDB queries—no manual SQL writing.
  • Multi-database: Supports both SQL and MongoDB, reducing complexity in hybrid systems (e.g., user data in SQL, logs in MongoDB).
  • Low risk: MIT license, active maintenance (last update: May 2026), and zero breaking changes in the latest release.

ROI Hook:

  • 'For every admin dashboard or reporting feature we ship, this saves 2–4 weeks of dev time—time we can reinvest in high-impact initiatives like [Product X] or [Customer Y].
  • Example: If we launch 3 new admin panels this quarter, this package could save 6–12 weeks of engineering effort, equivalent to $50K–$100K in developer costs (assuming $2K–$3K/week).'*

For Engineering Teams:

*"This package standardizes how we handle dynamic queries across the codebase, solving:

  1. Inconsistent SQL: No more copy-pasted, hardcoded queries that break when schemas change.
  2. Frontend-Backend Sync: jQuery QueryBuilder rules automatically translate to Eloquent queries, reducing API versioning headaches.
  3. Multi-Database Support: Write one parser for SQL and MongoDB, cutting maintenance time in half for hybrid systems.

How It Works:

  • Input: JSON rules from jQuery QueryBuilder (e.g., {"condition":"AND","rules":[{"field":"email","operator":"like","value":"%@gmail.com%"}]}).
  • Output: A Laravel query builder instance with parsed constraints (e.g., WHERE email LIKE '%@gmail.com%').

Integration:

  • Admin Panels: Replace custom filter logic in controllers with a single line:
    $query = (new QueryBuilderParser(['email', 'status']))->parse($request->querybuilder, DB::table('users'));
    
  • APIs: Use with Laravel’s Datatable package for seamless frontend-backend filtering:
    return Datatable::query($query)->showColumns(['email', 'status'])->make();
    
  • MongoDB: Same UI, same parser—just swap the query builder:
    $query = (new QueryBuilderParser(['name', 'email']))->parse($rules, DB::collection('users'));
    

Why Not Build It?:

  • Time: Building this from scratch would require 2–4 weeks of dev time (parsing JSON, handling operators, SQL injection protection, etc.).
  • Risk: Community-tested, with 161 stars and 28.845 score—far less risk than a custom solution.
  • Maintenance: Updates are handled by the maintainer; we only need to bump the dependency.

Next Steps:

  1. Pilot: Integrate into one admin panel (e.g., user management) to validate performance and accuracy.
  2. Document: Create internal docs for the new pattern (e.g., ‘How to Add a Filterable Table’).
  3. Expand: Roll out to APIs and reporting tools where dynamic queries are needed.

Blockers to Address:

  • If your frontend uses a non-compatible query UI, we’ll need to assess adaptation effort.
  • For highly custom SQL, we may need to extend the parser (but this is rare for 90% of use cases)."*
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.
calmfox/watch-sylius
damienfern/grpc-symfony-bundle
atoolo/index-bundle
atoolo/genai-bundle
coprotoai/laravel-ticket
davidjln/llm-carbon-bundle
cryonighter/valid-request-bundle
coolms/taxonomy-bundle
coolms/field-bundle
articulate-orm/symfony
aaix/laravel-tall-architect
ephoto/akeneo-connector
emmanuelballery/eb-plantumlbundle
emielburgman/symfony-visitor-beacon
emielburgman/symfony-visit-storage
emielburgman/symfony-security-headers
emielburgman/symfony-log-viewer
emarref/xdebug-bundle
emarref/pubnub-bundle
elriseio/finance-money-bundle