mheads/yii-table

Universal table provider for Yii applications: columns, filters, sorting, pagination, and export.

Maintainers

👁 alse0017

Package info

github.com/mheads-dev/yii-table

pkg:composer/mheads/yii-table

Statistics

Installs: 18

Dependents: 1

Suggesters: 0

Stars: 1

Open Issues: 0

1.0.2 2026-06-28 11:02 UTC

Requires

Suggests

  • ext-xlswriter: For XLSX export writer (Vtiful\Kernel\Excel).
  • yiisoft/data-response: For app-level payload formatting via DataResponseTablePayloadResponder.
  • yiisoft/db-mysql: For MySQL database support.
  • yiisoft/translator: For application-level i18n adapters used by table filters.

Provides

None

Conflicts

None

Replaces

None

BSD-3-Clause 3855fcf32fc837774c768649078a02ada7221ec5

  • MachineHeads
  • Sergey Alekseenko <sergei_alekseenk.woop@list.ru>

This package is auto-updated.

Last update: 2026-06-28 11:03:07 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.

Example application 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 for a single endpoint that applies request parameters and produces a JSON payload or an export response. Split config, rows, and export orchestrators are covered in HTTP usage:

4. Call your 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.