kinetis / queue
A backend-agnostic background job queue for Kinetis — no fluent job-scheduling DSL. Redis, SQL, SQS, and RabbitMQ backends each live in their own separate package.
Requires
- php: ^8.4
- kinetis/framework: ^1.28.3
- psr/container: ^2.0.2
- psr/log: ^3.0.2
Requires (Dev)
- infection/infection: ^0.35.0
- phpstan/phpstan: ^2.2.8
- phpunit/phpunit: ^12.5.33
- vimeo/psalm: ^6.16.1
Suggests
- ext-pcntl: Lets `kinetis queue:work` stop gracefully on SIGTERM, finishing the job in flight instead of being killed mid-job. Not loaded by default in the official PHP Docker images.
README
kinetis/queue
A backend-agnostic background job queue for Kinetis
One Kinetis\Queue\QueueInterface — push a job from application code, a
separate kinetis queue:work worker process pops and runs it. Named,
priority-ordered queues, bounded retries (maxAttempts, defaulting to
no retries at all), and named connections come built in. A job given up
on is logged with its arguments, minus any constructor parameter marked
Kinetis\Queue\Attributes\Sensitive. Every backend — Redis
(kinetis/queue-redis), SQL (kinetis/queue-sql), Amazon SQS
(kinetis/queue-sqs), and RabbitMQ (kinetis/queue-rabbitmq) — lives in
its own separate package; this one carries only the contract, the
worker, and the CLI commands.
use Kinetis\Queue\Job; use Kinetis\Queue\QueueInterface; final readonly class SendWelcomeEmail implements Job { public function __construct( public string $email, public string $name, ) {} public function handle(Mailer $mailer): void { $mailer->send($this->email, "Welcome, {$this->name}!"); } } $queue->push(new SendWelcomeEmail($email, $name), maxAttempts: 3);
vendor/bin/kinetis queue:work --queue=high,default
Provides
Installing this package is what opts it in — it registers the
following automatically, through the extra.kinetis declaration in its
composer.json (see
kinetis.dev/docs/cli.html):
- Commands on
vendor/bin/kinetis:queue:work(the worker loop, stopping gracefully on SIGTERM once the job in flight finishes),queue:stats(how many jobs are waiting), andqueue:clear(discard waiting jobs, requires--force). - Service binding: with
QUEUE_CONNECTIONset,QueueInterfaceis bound to the selected backend before your ownbootstrap.phpruns — your registration wins on the same binding. Inert whenQUEUE_CONNECTIONis unset.
Nothing else — no routes, middleware, event listeners, or MCP tools.
Configuration
Read from the environment (or .env) via Kinetis\Config — by
kinetis queue:work and by this package's bootstrap, which binds
QueueInterface to the selected backend with no application wiring.
Each backend's own connection details are documented in that backend's
own package (kinetis/queue-redis, kinetis/queue-sql,
kinetis/queue-sqs, kinetis/queue-rabbitmq) — this package installs
none of them, so picking QUEUE_CONNECTION=redis (say) without also
composer require kinetis/queue-redis fails clearly, naming the
package to install.
| Key | Default | Purpose |
|---|---|---|
QUEUE_CONNECTION |
(required) | redis, sql, sqs, or rabbitmq — each needs its own package installed. |
QUEUE_CONNECTION_NAME |
default |
Which named connection block the backend uses. |
QUEUE_MAX_ATTEMPTS |
0 |
Worker-level default attempts cap (0 = no retries); a job's own push(maxAttempts: ...) wins. |
QUEUE_POLL_TIMEOUT |
5 |
Seconds per pop() wait. |
Full reference across every package: kinetis.dev/docs/config.html.
Installation
composer require kinetis/queue
Requires PHP 8.4+ and kinetis/framework. Full documentation:
kinetis.dev/docs/queue.html.
License
MIT — see LICENSE.