Reference

PHP API

Native PHP functions exposed by the Pogo FrankenPHP plugins.

Queue

pogo_queue_push(string $queue, string $payload, int $delaySeconds = 0): string;
pogo_queue_ack(string $queue, string $deliveryId): int;
pogo_queue_release(string $queue, string $deliveryId, int $delaySeconds = 0): int;
pogo_queue_fail(string $queue, string $deliveryId, string $reason = ''): int;
pogo_queue_status(?string $queue = null): string;
pogo_queue_failed(string $queue, int $limit = 100): string;
pogo_queue_retry_failed(string $queue, string $failedId): string;
pogo_queue_forget_failed(string $queue, string $failedId): string;
pogo_queue_purge_failed(string $queue): string;

pogo_queue_push() returns JSON:

{
  "ok": true,
  "id": "1700000000-0",
  "code": 1
}

Failure responses include ok: false, a numeric code, and a human-readable message.

Queue result codes:

CodeMeaning
0Queue full
1Accepted
2Worker unavailable
3Payload too large
4Queue shutting down
5Backend failure
6Queue unknown

pogo_queue_status() returns JSON with ready and per-queue metrics such as pending, delayed, reserved, failed, enqueued, acked, released, backend_errors, and max_payload_bytes.

pogo_queue(string $data): int remains available as a deprecated v1 compatibility helper for immediate dispatch to the default queue.

The failed-job functions list, retry, forget, and purge deliveries from the failed stream. They return JSON status payloads.

Scheduler

Pogo Scheduler has no PHP API. It is configured through the pogo_scheduler Caddy global option.

Pogo

pogo_spawn(string $class, array $args = [], string $pool = 'default'): int;
pogo_await(int $task, float $timeout = 5.0): mixed;
pogo_pool_size(string $pool = 'default'): int;

pogo_spawn() returns a task id. pogo_await() waits for the task and returns the decoded result.

pogo_await() throws RuntimeException for unknown tasks, timeouts, worker failures, invalid worker responses, and task exceptions returned by the worker.

Upload

pogo_upload_create(array $intent, string $store = 'default'): array;
pogo_upload_progress(string $uploadId, string $store = 'default'): ?array;
pogo_upload_cancel(string $uploadId, string $store = 'default'): bool;
pogo_upload_status(?string $store = null): string;

pogo_upload_create() returns an upload id, HTTP method, signed URL, required headers, expiry, and maximum byte count. The returned URL is a bearer credential.

pogo_upload_progress() returns process-local progress or null when the upload is unknown to the current process or its progress record expired.

pogo_upload_status() returns JSON readiness, per-store limits, upload counters, rejection counters, backend failures, worker event failures, and byte counters.

WebSocket

pogo_websocket_publish(string $appId, string $channel, string $event, string $data): int;
pogo_websocket_broadcast_multi(string $appId, string $channels, string $event, string $data): int;

$data must be a JSON string. $channels for pogo_websocket_broadcast_multi() must be a JSON encoded array of channel names.

Return status codes:

CodeMeaning
0Success
1Hub missing
2Channel too long
3Event too long
4Payload too large
5Invalid payload JSON
6Broker publish failed
7Invalid multi-channel JSON
8Broker queue full
9Shard queue full