mheads/yii-table

Maintainers

Package info

github.com/mheads-dev/yii-table

pkg:composer/mheads/yii-table

Statistics

Installs: 3

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

1.0.0-beta1 2026-06-03 07:46 UTC

This package is auto-updated.

Last update: 2026-06-03 07:53:58 UTC


README

Universal table provider for Yii3 / yiisoft applications: columns, filters, sorting, pagination, export.

yii-table gives you a backend contract for data grids. You describe table schema once, then reuse it for HTTP payloads, filtering, sorting, pagination, and export.

What You Get

  • predictable API payload: config, pagination, columns, filters, sorts, rows;
  • one place to configure columns, filters, sort options, pagination, and export;
  • request parameters applied consistently: filter, sort, page, prev-page, per-page, export;
  • CSV/XLSX export and custom formats via WriterInterface;
  • support for Yiisoft\Data\Reader\ReadableDataInterface sources from yiisoft/data.

Typical request:

/products?filter[categoryName]=Audio&per-page=2&page=1

Full example payload:

Requirements

  • PHP 8.3 - 8.5.
  • yiisoft/data 2.x.
  • psr/http-message 2.x.

Optional integrations:

  • yiisoft/data-db for QueryDataReader;
  • yiisoft/data-response for application-level response formatting;
  • yiisoft/translator for i18n adapters;
  • ext-xlswriter for XLSX export.

Installation

Install the package with Composer:

composer require mheads/yii-table

Quick Start

1. Configure DI

Start with minimal HTTP wiring:

2. Create a table factory

Declare columns, filters, sort options, page size, and export formats:

3. Add an HTTP action

Use TableHttpOrchestrator to apply request parameters and produce a JSON payload or an export response:

4. Call the endpoint

/products?sort=-name&per-page=10&page=1&filter[name]=headphones

5. Try export

/products?export=csv
/products?export=xlsx

Documentation

Common entry points:

Examples

The examples are intentionally compact and focused on contract demonstration. They are not intended to be executed directly from vendor/.../examples without adaptation.

License

This package is released under the terms of the BSD-3-Clause License. See LICENSE.md for details.