The fluent API lets you build queries by chaining PHP method calls. Every method returns the query object, so calls can be composed in any order.Documentation Index
Fetch the complete documentation index at: https://docs.fiquela.io/llms.txt
Use this file to discover all available pages before exploring further.
As of FiQueLa 3.0, the fluent helpers are expression-first:
select, where, having, groupBy, orderBy, and every scalar / aggregate helper accept full SQL expression strings. They route their field arguments through the same parser that powers FQL, so $query->select('ROUND(price * 1.21, 2) AS gross'), $query->groupBy('YEAR(date)'), $query->where('LOWER(name)', Op::EQ, 'alice'), and $query->sum('price + vat') all work end-to-end. Infix arithmetic (+ - * / %) and nested function calls are valid in every clause.Every query implements
\Stringable. Cast a query to a string to see the equivalent FQL representation — useful for debugging.Field path syntax
FiQueLa uses a dot-separated path to reference fields in nested data structures. Beyond simple dot access, the path syntax supports several advanced features:| Syntax | Description | Example |
|---|---|---|
a.b.c | Standard nested access | brand.code |
a.b.0.c | Indexed access (numeric key) | items.0.name |
a.b[].c | Iterated access — traverses all elements of an array | items[].price |
a.b.*.c | Wildcard — expands all keys of an associative array | attributes.*.value |
`key.with.dot` | Backtick-escaped key — treats the enclosed string as a single key | `Prod. cena`.`s dph` |
x[0] | Index into a scalar or wrapped value | tags[0] |
select(), where(), orderBy(), groupBy(), on(), and inside function arguments. Scalar functions accept [] paths and operate on the flattened array — for example, $query->length('products.product[]') returns the element count, and $query->implode('products.product[].name', ', ') joins every nested name.
Prior to FiQueLa 3.0.2, scalar functions wrapping a
[] path returned null. Upgrade to 3.0.2 or later to use array-iterator paths inside scalar functions.Selecting fields
Useselect() to specify which fields to include. Dot notation accesses nested fields. Multiple select() calls merge their fields.
selectAll() to select all fields (equivalent to SELECT *). You can combine it with additional fields:
Aliases
Chainas() after select(), from(), or a join method to create an alias. The as() method is context-aware — it detects what was called before it and aliases accordingly:
| Context | Example | Effect |
|---|---|---|
After select() | ->select('id')->as('clientId') | Aliases the last selected field |
After from() | ->from('data.products')->as('p') | Aliases the FROM source |
After join() | ->leftJoin($query)->as('o') | Aliases the joined source |
When used after
select(), as() only aliases the last field in the preceding call. For example, select('id', 'name')->as('o') creates id, name AS o.DISTINCT
Remove duplicate rows withdistinct():
EXCLUDE
Useexclude() to remove fields from the output — useful when applying functions and you want only the computed result:
Aliased wildcards
When a source has an alias (fromfrom()->as() or a join), use alias.* in select() to select all fields from that specific source:
alias.* for both, a SelectException is thrown on ambiguous field conflicts.
Specifying the data path
Usefrom() to point to the data root within the file. Dot notation traverses nested structures:
Query\Provider::fromFileQuery(), the path embedded in the FileQuery string sets the initial from.
FROM aliasing
Chainas() after from() to alias the data source. Aliased fields are then accessible via alias.field dot notation:
FROM json(products.json).data.products AS p.
Pagination and limits
Sorting
ChainorderBy() with asc() or desc(). Multiple orderBy() calls define a multi-column sort. Dot notation is supported for sorting by nested fields.
Conditions
Filter rows withwhere(), then chain and(), or(), or xor():
Joins
Join other files or queries usinginnerJoin(), leftJoin(), rightJoin(), or fullJoin(), followed by on() to define the join condition. You can pass the alias as a second parameter or chain ->as() fluently:
Grouping and aggregations
Group rows withgroupBy() and apply aggregate functions:
UNION
Combine results from multiple queries:SELECT * skip this check).
EXPLAIN
Inspect the query execution plan without running the full query, or run it with timing data:DESCRIBE
Usedescribe() to inspect the schema of a data source instead of querying its data. The result is a DescribeResult containing one row per column with type statistics, completeness, and uniqueness information.
DESCRIBE is mutually exclusive with SELECT, WHERE, GROUP BY, ORDER BY, LIMIT, JOIN, UNION, and EXPLAIN. Calling any of these after describe() throws a QueryLogicException.
Output columns
| Column | Type | Description |
|---|---|---|
column | string | Column name (dot notation for nested objects) |
path | string[] | Array of path segments to the column. Useful for correctly evaluating nested fields whose keys contain dots or special characters. |
types | array | Map of type name to occurrence count |
totalRows | int | Number of non-empty rows for this column |
totalTypes | int | Number of distinct types observed |
dominant | string | Most frequent type |
suspicious | bool | true if column has mixed non-empty types (except int+double) |
confidence | float | Ratio of dominant type occurrences to total (0.0–1.0) |
completeness | float | Ratio of non-empty rows to total rows (0.0–1.0) |
constant | bool | true if all non-empty values are identical |
isEnum | bool | true if column has 2–5 unique values |
isUnique | bool | true if all non-empty values are unique |
Detected types
| Type | Description |
|---|---|
int | Integer value |
double | Float/double value |
string | Non-empty string |
bool | Boolean value |
array | Indexed array |
null | Null value |
empty-string | Empty string "" |
whitespace | String containing only whitespace |
bool-string | String "yes" or "no" |
date-string | ISO 8601 date/datetime string |