mheads / yii-table
Requires
- php: 8.3 - 8.5
- psr/http-message: ^2.0
- yiisoft/data: ^2.0
Requires (Dev)
- ext-pdo: *
- friendsofphp/php-cs-fixer: ^3.94
- httpsoft/http-message: ^1.1
- phpunit/phpunit: ^12.5
- vimeo/psalm: ^6.16
- yiisoft/active-record: ^1.0.2
- yiisoft/cache: ^3.0
- yiisoft/data-db: ^1.0
- yiisoft/db: ^2.0
- yiisoft/db-mysql: ^2.0
- yiisoft/di: ^1.4
- yiisoft/dummy-provider: ^1.1
- yiisoft/factory: ^1.3
- yiisoft/test-support: ^3.2
- yiisoft/translator: ^3.2
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.
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\ReadableDataInterfacesources fromyiisoft/data.
Typical request:
/products?filter[categoryName]=Audio&per-page=2&page=1
Full example payload:
Requirements
- PHP 8.3 - 8.5.
yiisoft/data2.x.psr/http-message2.x.
Optional integrations:
yiisoft/data-dbforQueryDataReader;yiisoft/data-responsefor application-level response formatting;yiisoft/translatorfor i18n adapters;ext-xlswriterfor 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:
- Filters
- Sorting
- Pagination
- Keyset pagination
- Sync export
- Async export
- I18n
- HTTP error contract
- Advanced documentation map
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.