Skip to content

URL Syntax & Supported Filters

The package seamlessly supports two distinct formats for URL parameters. You can use whichever format best fits your frontend application.

1. JSON Syntax

You can pass raw JSON strings directly into the URL parameter. This is ideal for modern JavaScript frontends that easily serialize objects.

OperationExample URL
Filters?filters={"name":{"like":"John"}}
Sorts?sorts={"created_at":"desc"}
Fields?fields=["id","name"]
Includes?includes={"posts":{"fields":["id","title"]}}
Pagination?page={"number":2,"limit":50}

2. Structured Array Syntax

The standard PHP/Laravel nested array syntax. This is ideal for traditional HTML forms or programmatic URL generation.

OperationExample URL
Filters?filters[name][like]=John
Sorts?sorts[created_at]=desc
Fields?fields[]=id&fields[]=name
Includes?includes[posts][fields]=id,title
Pagination?page[number]=2&page[limit]=50

Supported Filter Operators

OperatorDescriptionURL Example (Array Syntax)DB Support
or, and, notLogical grouping?filters[or][0][status][eq]=activeUniversal
eq, neEqual / Not Equal?filters[status][eq]=activeUniversal
like, notlikePattern matching?filters[name][like]=JohnUniversal
ilike, notilikeCase-insensitive matching?filters[email][ilike]=HOTMAILUniversal (Graceful fallback)
gt, gteGreater than (or equal)?filters[price][gt]=100Universal
lt, lteLess than (or equal)?filters[age][lte]=18Universal
in, ninIn list / Not in list?filters[id][in]=1,2,3Universal
null, notnullNull checks?filters[deleted_at][null]=trueUniversal
between, nbetweenRange queries?filters[price][between]=10,50Universal
containsJSON/Array contains?filters[tags][contains]=urgentUniversal
exists, notexistsRelationship existence?filters[posts][exists]=trueUniversal
year, month, dayDate component match?filters[created_at][year]=2024Universal
date, timeExact date/time match?filters[created_at][date]=2024-01-01Universal
containedbyJSON array contained by?filters[tags][containedby]=["urgent"]PostgreSQL only
overlapJSON array overlap?filters[tags][overlap]=["urgent"]PostgreSQL only
ftsFull-text search?filters[content][fts]=laravelUniversal

(Note: PostgreSQL-specific operators securely abort with an InvalidArgumentException if executed on non-PostgreSQL engines to prevent raw SQL syntax errors).