Download the PHP package nixphp/queue without Composer
On this page you can find all versions of the php package nixphp/queue. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Package queue
Short Description NixPHP Queue Plugin for asynchronous jobs.
License MIT
Informations about the package queue
[!IMPORTANT] NixPHP is now NAF — "Not Another Framework".
This package continues as
naf/queue: github.com/nafphp/queue · documentation · what changed and how to moveThe old name collided with NixOS down to the shell, where the CLI binary was literally
nix. This repository is archived and receives no further releases;nixphp/queuestays on Packagist so existing installations keep working.Note the plugin type. NAF discovers plugins by the Composer type
naf-plugin. A package still declaringnixphp-pluginis not loaded — silently, with no error.
nixphp/queue
Minimalistic queueing for NixPHP – file-based, simple, and extendable.
This plugin provides a lightweight job queue system with CLI worker support and no external dependencies by default.
🧩 Part of the official NixPHP plugin collection.
Use it when you want to delay tasks, run background jobs, or decouple logic – without setting up Redis or RabbitMQ.
📦 Features
- File-based queue driver (no DB or Redis required)
- CLI worker for background processing
- Logical channels (single queue, multiple job streams)
- One-off async execution (
pushAndRun()) - Deadletter handling per channel
- Retry support (channel-aware)
- Fully PSR-4 and event-loop friendly
- Extendable: write your own driver for SQLite, Redis, etc.
📥 Installation
`
That’s it. The plugin will be autoloaded automatically.
Usage
Queue a job (default channel)
Create a job class that implements the QueueJobInterface:
Push it to the default queue:
🧵 Using channels
Channels are logical job streams inside the same queue backend.
They allow you to separate workloads (e.g. emails, mcp_out, notifications)
without running multiple queue systems.
Push a job to a specific channel:
Internally, channels are handled by the queue driver.
⚡ Fire-and-forget (async)
For one-off asynchronous execution, use:
This queues the job and immediately runs it in the background via a short-lived CLI process, automatically passing the channel to the worker.
Ideal for emails, logging, notifications, or side-effects that should not block a request.
Start the worker
Run the consuming worker and listen on the default channel:
Listen on a specific channel:
Listen on multiple channels (checked in order):
Run a single job only:
🔹
--onceis also used internally bypushAndRun().
Deadletter & Retry (channel-aware)
If a job fails too often, it is written to a deadletter directory per channel:
Retry failed jobs for the default channel:
Retry failed jobs for a specific channel:
By default, retried jobs are removed from the deadletter queue.
Use --keep to retain them:
🧠 Drivers
The queue system is driver-based. Included drivers:
| Driver | Description | Suitable for |
|---|---|---|
FileDriver |
Stores jobs as .job files in folders |
Local use, no DB needed |
| (planned) | SQLite / Redis / others | Larger or shared setups |
To register a custom driver, configure it in your bootstrap.php:
📁 The file paths are only relevant for
FileDriver.
🛠️ Supervisor example (optional)
To run the worker persistently in production, use Supervisor:
✅ Requirements
nixphp/framework^0.1.0nixphp/cli^0.1.0 (required for worker commands)
📄 License
MIT License.