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 Query Builder Laravel Package

spatie/laravel-query-builder

Safely build Eloquent queries from incoming API requests. Allowlist filters, sorts, includes, and fields; supports partial/exact and custom filters, nested relationships, relation counts, and default values. Works with existing queries for clean, consistent endpoints.

View on GitHub
Deep Wiki
Context7

title: Multi value delimiter weight: 4

Sometimes values to filter for could include commas. You can change the delimiter used to split array values by setting the delimiter key in the query-builder config file.

// config/query-builder.php

return [
    'delimiter' => '|',
];

With this configuration, a request like GET /api/endpoint?filter[voltage]=12,4V|4,7V|2,1V would be parsed as:

// filters: [ 'voltage' => [ '12,4V', '4,7V', '2,1V' ]]

Note that this applies to ALL values for filters, includes and sorts.

To disable splitting entirely for all parameters, set the global delimiter to an empty string:

// config/query-builder.php

return [
    'delimiter' => '',
];

Per filter delimiter

You can override the delimiter for a specific filter using the delimiter() method. This is useful when a filter value may contain the default delimiter character.

// GET /api/endpoint?filter[voltage]=12,4V|4,7V|2,1V&filter[name]=John,Jane

QueryBuilder::for(Model::class)
    ->allowedFilters(
        AllowedFilter::exact('voltage')->delimiter('|'),
        AllowedFilter::exact('name'), // still uses the default comma delimiter
    )
    ->get();

To disable splitting entirely for a filter, set the delimiter to an empty string:

AllowedFilter::exact('external_id')->delimiter('')
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.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
enqueue/dsn
bunny/bunny
enqueue/test
enqueue/null
enqueue/amqp-tools
milesj/emojibase
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport