Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 0
Home
Welcome to the official documentation for initphp/queue — the
framework-less BabelQueue runtime for plain PHP.
It gives an application that has no Laravel queue or Symfony Messenger of its own
the piece babelqueue/php-sdk
deliberately leaves to the framework: the consumer loop, retries with back-off
and dead-letter routing — plus a database (PDO) transport the core SDK does
not ship.
Because it reuses the SDK's canonical { job, trace_id, data, meta, attempts }
envelope, the queue you produce and consume here is the same queue a Go,
Python, Node or .NET service reads. Messages are routed by a stable URN
(urn:babel:orders:created), never a PHP class name.
composer require initphp/queue predis/predisuseBabelQueue\Contracts\InboundMessage;
useInitPHP\Queue\Consumer\{Dispatcher, Worker, WorkerOptions};
useInitPHP\Queue\Contracts\Handler;
useInitPHP\Queue\Producer\Producer;
useInitPHP\Queue\Routing\HandlerMap;
useInitPHP\Queue\Transport\Redis\RedisTransport;
// A handler is mapped to a URN, not a class name.finalclass SendWelcomeEmail implements Handler
{
publicfunctionhandle(InboundMessage$message): void
{
$email = $message->getData()['email'];
// ... send it. Throwing marks the message as failed (retry, then dead-letter).
}
}
$transport = newRedisTransport(newPredis\Client('tcp://127.0.0.1:6379'));
// Produce
(newProducer($transport, 'emails'))
->send('urn:babel:users:registered', ['user_id' => 42, 'email' => 'jane@example.com']);
// Consume$handlers = (newHandlerMap())->register('urn:babel:users:registered', SendWelcomeEmail::class);
$worker = newWorker($transport, newDispatcher($handlers), newWorkerOptions(maxAttempts: 3));
$worker->run('emails');| Layer | babelqueue/php-sdk | InitPHP Queue |
|---|---|---|
| Wire format / contract | Canonical envelope, URN scheme, validation, dead-letter annotation | reuses it |
| Producer | EnvelopeCodec + a publish Transport | Producer facade |
| Consumer loop | — (left to the framework) | Worker: reserve → route → ack / retry / dead-letter |
| Transports | Redis & AMQP (publish only) | Redis, AMQP and PDO (publish + consume) |
- New to the package? Read Installation then Quick Start.
- Want the big picture? Read Core Concepts.
- Coming from
1.x? Read Migration from 1.x.
Use the sidebar to navigate. Every code example on this wiki reflects the real public API of the current release.
- PHP 8.2+
babelqueue/php-sdk ^1.0(installed automatically)- A client for your broker:
ext-pdo,predis/predis(Redis 6.2+), orphp-amqplib/php-amqplib
InitPHP Queue · GitHub · Packagist · BabelQueue standard · MIT License