mheads/yii-table-export-queue

Asynchronous table export queue integration for mheads/yii-table.

Maintainers

Package info

github.com/mheads-dev/yii-table-export-queue

pkg:composer/mheads/yii-table-export-queue

Statistics

Installs: 1

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

1.0.0 2026-06-19 05:29 UTC

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/db and the export table from the package migration.
  • An application queue connected via QueueAdapterInterface.
  • A file registry connected via FileRegistryInterface. The ready-to-use YiiFilestorageFileRegistry adapter is optional: it stores files with mheads/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:

  • RepositoryInterface for storing export records;
  • TableRegistryInterface for restoring a table by tableId;
  • QueueAdapterInterface for pushing jobs to the queue;
  • FileRegistryInterface for storing the result file (YiiFilestorageFileRegistry is a ready-to-use adapter for a separately installed mheads/yii-filestorage);
  • UserIdResolverInterface for resolving the current user.

Configuration example: Configuration.

2. Add HTTP Timeout Fallback

Use a timeout fallback orchestrator around the table HTTP orchestrator:

  • TableHttpOrchestratorWithTimeoutFallback for the common table endpoint;
  • TableExportHttpOrchestratorWithTimeoutFallback for 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": "..."
}

See HTTP timeout fallback.

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.