Server API reference (PHP)
Namespace: Elyra\DataGrid\Server. Install via composer require elyra/datagrid-server.
Grid
Factory entry point.
Grid::table(string $table): GridDefinition
GridDefinition
Fluent builder + the security allow-list.
| Method | Returns | Purpose |
|---|---|---|
table(string) (static) |
self | Create a definition. |
key(string $column) |
self | Primary key (tiebreaker, editing, selection). |
connection(?string $name) |
self | config/database.php connection. |
driver(string|GridDriver) |
self | 'elyrasql' (default), 'mysql', or an instance. |
column(string $key, ...) |
self | Declare one column (see below). |
columns(array $keys) |
self | Quick-add columns with defaults. |
searchable(array $keys) |
self | Mark columns for global search. |
respond(GridRequest) |
array | Execute a query → GridResponse array. |
mutate(GridMutation) |
array | create/update/delete → GridMutationResult array. |
export(GridRequest, string $format = 'csv', string $filename = 'export') |
StreamedResponse | Streamed CSV/XLSX. |
editableColumns() |
GridColumn[] | Columns writable via mutations. |
all() |
array | All declared columns. |
column() signature
public function column(
string $key,
?string $column = null, // real column (default: key)
?string $expression = null, // raw SQL (read-only, not quoted)
bool $sortable = true,
bool $filterable = true,
bool $searchable = false,
?bool $aggregatable = null, // numeric → true
string $type = 'string', // string|number|date|bool
bool $editable = false, // write allow-list
string $editor = 'text', // text|number|select|date|checkbox
string|array|null $rules = null, // Laravel validation
array $options = [], // [['value'=>..,'label'=>..]] for select
): self
GridColumn
Value object describing one column (key, column/expression, sortable,
filterable, searchable, aggregatable, type, editable, editor,
rules, options). isExpression() reports whether it is a raw expression
(read-only).
Drivers — Contracts\GridDriver
Implement to support another dialect. Built-in:
| Class | Notes |
|---|---|
Drivers\ElyraSqlDriver (default) |
FACET() single-pass facets, WITH ROLLUP, PERCENTILE/MEDIAN, HYBRID search. |
Drivers\MySqlDriver |
Portability fallback; facets via N GROUP BY; no percentile/hybrid. |
Interface surface: name(), quote(), ref(), aggregateExpr(),
supportsRollup(), groupBy(), facetQueries(), searchPredicate().
Engine internals
GridEngine— orchestratesrespond(): WHERE (filter + search) → viewport rows / groups / total / aggregates / facets / timing. Grouping runs oneGROUP BYper level so non-additive aggregates (avg/median/percentile/ countDistinct) are correct at every level.exportKeyset()returns the single-pass export plan (selects / table / where / bindings / key).GridMutator— validates and writes create/update/delete (only editable columns, bound values).GridExporter— streams CSV (BOM +;) or a rich XLSX (openspout: bold header band,#,##0.00numeric columns, column widths). Reads in bounded key-range windows (key >= a AND key < b) for constant memory on ElyraSQL.
Exceptions
Exceptions\GridException is thrown for unknown fields, disallowed operations
(non-sortable/filterable), unsupported driver features, or bad operators — the
security guardrail that keeps clients within the declared schema.
Service provider
GridServiceProvider is auto-discovered. The Livewire package adds
GridLivewireServiceProvider (views, translations, inlined theme).