mheads/yii-table
Composer 安装命令:
composer require mheads/yii-table
包简介
Universal table provider for Yii applications: columns, filters, sorting, pagination, and export.
README 文档
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.
Example application 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 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:
- 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.
统计信息
- 总下载量: 16
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 2
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: BSD-3-Clause
- 更新时间: 2026-06-03