Use this file to discover all available pages before exploring further.
This guide shows three ways to open a file and run a query. All approaches produce the same result — choose the one that fits your style.
1
Install FiQueLa
If you haven’t already, add the package to your project:
composer require 1biot/fiquela
Then include the autoloader:
require __DIR__ . '/vendor/autoload.php';
2
Approach 1: Open a file with Stream\Provider
Use Stream\Provider::fromFile to open a file and call ->query() to start building a query with the fluent API. The format is inferred automatically from the file extension.
You can also open specific stream classes directly:
use FQL\Stream;$xml = Stream\Xml::open('./products.xml');
Pass an explicit Enum\Format constant as the second argument to fromFile when the extension is ambiguous or missing: Stream\Provider::fromFile('./data', Enum\Format::XML).
3
Approach 2: FileQuery syntax with Query\Provider
Query\Provider::fromFileQuery accepts a compact string that encodes the format, file path, and data path in one expression. This is useful for quick one-liners.
use FQL\Enum\Operator as Op;use FQL\Query;$results = Query\Provider::fromFileQuery('xml(./products.xml).SHOP.SHOPITEM') ->selectAll() ->where('EAN', Op::EQUAL, '1234567891011') ->or('PRICE', Op::LESS_THAN_OR_EQUAL, 200) ->orderBy('PRICE')->desc() ->limit(10) ->execute() ->fetchAll();print_r(iterator_to_array($results));
Query\Provider::fql accepts a full SQL-like string. This is the most expressive option and mirrors the FQL syntax closely.
use FQL\Query;$query = <<<FQL SELECT * FROM xml(./products.xml).SHOP.SHOPITEM WHERE EAN = "1234567891011" OR PRICE <= 200 ORDER BY PRICE DESC LIMIT 10FQL;$results = Query\Provider::fql($query) ->execute() ->fetchAll();print_r(iterator_to_array($results));
5
Inspect the output
All three approaches produce the same array structure: