Prepare the data in PHP, register it in the report dictionary, and render the template with those records.

Preparing the data. Read or create the data source, register it in the report dictionary, synchronize the schema, and render with the supplied records.
$report->engine = StiEngineType::ServerNodeJS;
$report->onBeginProcessData = function (StiDataEventArgs $args) {
    if ($args->connection == 'MyConnectionName')
        $args->connectionString = 'Server=localhost; Database=northwind; UserId=root; Pwd=;';
    if ($args->dataSource == 'MyDataSource')
        $args->queryString = 'SELECT * FROM MyTable';
};
$report->process();
$report->loadFile('reports/SimpleListSQL.mrt');
$report->render();


The event fires on the server as data is processed, so a headless render can query databases securely, with the connection string and query controlled entirely in PHP.