Overview
Namespace:FQL\Stream
Stream\Provider opens a data file or an in-memory string and returns a stream object. Each stream implements Interface\Stream and exposes a query() method that returns a Query ready to run against that stream.
You rarely need to call stream classes directly — Query\Provider::fromFile() wraps Stream\Provider automatically. Use Stream\Provider directly when you need to configure the stream (e.g. set a custom CSV delimiter) before building a query.
Stream\Provider static methods
fromFile()
Open a file and return the matching stream object. The format is detected from the file extension unless $format is provided.
string
required
Absolute or relative path to the data file.
FQL\Enum\Format | null
Override the auto-detected format.
FQL\Interface\Stream
A concrete stream instance (e.g.
Json, Csv, Xml).FileNotFoundException, InvalidFormatException
fromString()
Create a stream from an in-memory string. Supported formats: JSON, YAML, NEON.
string
required
The raw string content to parse.
FQL\Enum\Format
required
The format of the string content. Must be
Format::JSON, Format::YAML, or Format::NEON.FQL\Interface\Stream
A stream wrapping the parsed string.
InvalidFormatException for unsupported formats (e.g. XML, CSV).
Stream classes
Each stream class can also be instantiated directly via its staticopen() method. After obtaining a stream instance, call ->query() to get a Query.
Xml
Class: FQL\Stream\XmlFormats:
.xml
Json
Class: FQL\Stream\JsonFormats:
.json (full in-memory parse)
JsonStream for large files.
JsonStream
Class: FQL\Stream\JsonStreamFormats:
.json (streaming, lazy)
NDJson
Class: FQL\Stream\NDJsonFormats:
.ndjson (Newline Delimited JSON)
Csv
Class: FQL\Stream\CsvFormats:
.csv, .tsv
string
required
Path to the CSV file.
fgetcsv (no third-party dependency) and accepts the parameters listed below. Defaults are applied when a parameter is omitted.
To use a custom delimiter directly, call
openWithDelimiter(). For full control over encoding, enclosure, header handling, and BOM, use a FileQuery string.
Yaml
Class: FQL\Stream\YamlFormats:
.yaml, .yml
Neon
Class: FQL\Stream\NeonFormats:
.neon
Xls
Class: FQL\Stream\XlsFormats:
.xlsx
.xlsx format (Office Open XML) is supported. Legacy .xls (Excel 97–2003 binary format) is no longer supported — convert old files to .xlsx first.
Ods
Class: FQL\Stream\OdsFormats:
.ods
AccessLog
Class: FQL\Stream\AccessLogFormats:
.log
log_format pattern.
setFormat(string $format): void — Sets the active log profile. Accepts nginx_combined (default), nginx_main, apache_combined, apache_common, or custom (requires a setPattern() call).
setPattern(string $pattern): void — Sets a custom Apache log_format pattern. Only effective when the format is custom.
Predefined profiles:
Special fields in every row:
AccessLog does not support string() — only file-based input via open(). Malformed log lines produce a row with the _error field set instead of throwing an exception.Dir
Class: FQL\Stream\DirFormats:
dir
query() method
All stream classes inherit query() from AbstractStream.
Query bound to this stream. See the Query\Provider reference for the full fluent API.