kornrunner/honker

Pure PHP binding for Honker. SQLite-native queues, streams, pub/sub and scheduling.

Maintainers

Package info

github.com/kornrunner/php-honker

pkg:composer/kornrunner/honker

Statistics

Installs: 0

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

dev-main 2026-05-28 20:19 UTC

This package is auto-updated.

Last update: 2026-05-29 19:33:47 UTC


README

A pure PHP binding for Honker, which brings durable queues, streams, pub/sub and a cron scheduler to a SQLite file. The API mirrors the Ruby binding and is pinned to the ext-v0.2.3 Honker tag.

Honker is a SQLite loadable extension by Russell Romney, written in Rust, that brings Postgres-style NOTIFY/LISTEN semantics plus durable work queues, append-only streams and a cron scheduler to SQLite. No Redis, no broker, no extra process. This package is a thin wrapper around its SQL functions over a Pdo\Sqlite connection.

Installation

$ composer require kornrunner/honker

You also need the Honker SQLite extension itself. Build it from source (requires a Rust toolchain) and point the binding at it via HONKER_EXTENSION_PATH or the constructor:

$ git clone --depth 1 --branch ext-v0.2.3 https://github.com/russellromney/honker.git
$ cargo build --release -p honker-extension --manifest-path honker/Cargo.toml

Usage

Enqueue and claim

<?php

require_once 'vendor/autoload.php';

use kornrunner\Honker\Database;

$db = new Database('app.db', extensionPath: '/path/to/libhonker_ext.so');
$emails = $db->queue('emails');

$emails->enqueue(['to' => 'alice@example.com']);

$job = $emails->claimOne('worker-1');
if ($job !== null) {
    send_email($job->payload());
    $job->ack();
}

Transactional outbox

Couple a business write and a job enqueue atomically; workers only see the job if the transaction commits:

use kornrunner\Honker\Transaction;

$db->transaction(function (Transaction $tx) use ($db, $emails): void {
    $tx->execute('INSERT INTO orders (user_id) VALUES (?)', [42]);
    $emails->enqueueTx($tx, ['to' => 'alice@example.com']);
});

Streams

$stream = $db->stream('user-events');
$stream->publish(['user_id' => 7]);

foreach ($stream->readFromConsumer('dashboard', 100) as $event) {
    handle($event->payload);
    $stream->saveOffset('dashboard', $event->offset);
}

Tests

Unit tests run without the native extension. Integration tests run when HONKER_EXTENSION_PATH points at a real Honker .so. A Dockerfile builds the extension and runs the full suite end-to-end:

$ docker compose run --rm test

Contributing

Issues, feature requests or improvements welcome!

Licence

This project is licensed under the MIT License.

Stargazing

Star History Chart