mheads / yii-table-export-queue
Asynchronous table export queue integration for mheads/yii-table.
Package info
github.com/mheads-dev/yii-table-export-queue
pkg:composer/mheads/yii-table-export-queue
Requires
- php: 8.3 - 8.5
- httpsoft/http-message: ^1.1
- mheads/yii-table: ^1.0
- psr/http-message: ^2.0
- psr/http-server-handler: ^1.0
- yiisoft/data-db: ^1.0
- yiisoft/db: ^2.0.1
- yiisoft/input-http: ^1.0
- yiisoft/yii-console: ^2.4
Requires (Dev)
- ext-pdo: *
- friendsofphp/php-cs-fixer: ^3.94
- mheads/yii-filestorage: ^1.0
- phpunit/phpunit: ^12.5
- vimeo/psalm: ^6.16
- yiisoft/cache: ^3.0
- yiisoft/db-migration: ^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
Suggests
- mheads/yii-filestorage: For using the optional YiiFilestorageFileRegistry adapter.
- yiisoft/db-migration: For applying package migrations.
- yiisoft/db-mysql: For MySQL database support.
This package is auto-updated.
Last update: 2026-06-19 05:35:28 UTC
README
Asynchronous table export module for Yii3/yiisoft projects. It extends mheads/yii-table: when a synchronous HTTP export cannot finish within the timeout, the export is queued, processed by a worker, and made available for later download.
Requirements
- PHP 8.3-8.5.
mheads/yii-table.yiisoft/dband the export table from the package migration.- An application queue connected via
QueueAdapterInterface. - A file registry connected via
FileRegistryInterface. The ready-to-useYiiFilestorageFileRegistryadapter is optional: it stores files withmheads/yii-filestorage, which must be installed separately if you choose this adapter.
Installation
Install the package with Composer:
composer require mheads/yii-table-export-queue
Apply the export table migration. See Migrations.
Quick Start
1. Configure Dependencies
Register the main interfaces:
RepositoryInterfacefor storing export records;TableRegistryInterfacefor restoring a table bytableId;QueueAdapterInterfacefor pushing jobs to the queue;FileRegistryInterfacefor storing the result file (YiiFilestorageFileRegistryis a ready-to-use adapter for a separately installedmheads/yii-filestorage);UserIdResolverInterfacefor resolving the current user.
Configuration example: Configuration.
2. Add HTTP Timeout Fallback
Use a timeout fallback orchestrator around the table HTTP orchestrator:
TableHttpOrchestratorWithTimeoutFallbackfor the common table endpoint;TableExportHttpOrchestratorWithTimeoutFallbackfor a dedicated export endpoint.
On ExportTimeoutException, the module creates a record with the queued status, pushes a job to the queue, and returns:
{
"status": "queued",
"exportId": "..."
}
3. Register User Actions
Register HTTP actions for exports owned by the current user:
- export table;
- export table configuration;
- export table rows;
- finished export download;
- export deletion or cancellation.
See User actions.
4. Run a Worker
The queue worker must receive the raw payload from your queue transport and pass it to JobPayloadConsumer::consume().
JobHandler will restore the table, apply the filter/sort snapshot, run the export, and store the file.
See Worker consumer.
5. Schedule Cleanup
Add table-export:cleanup to cron/scheduler to delete canceled and expired exports and mark stale running exports as failed.
See Cleanup command.
Documentation
License
BSD-3-Clause. See LICENSE.