Download the PHP package tina4stack/tina4php-queue without Composer
On this page you can find all versions of the php package tina4stack/tina4php-queue. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package tina4php-queue
Tina4 Queue
A lightweight, backend-agnostic queueing system for the Tina4 PHP framework. Supports multiple backends through a unified interface, with generator-based consumption inspired by Python's yield pattern.
Features
- Generator-based consumption — iterate messages with
foreach, no polling callbacks - Multiple backends: LiteQueue (SQLite), RabbitMQ, MongoDB, Kafka
- Multi-queue consumers with round-robin support
- Batch processing for high-throughput scenarios
- Exponential backoff on empty queues (LiteQueue, MongoDB)
- Event-driven consumption for RabbitMQ (
basic_consume) - UUIDv7 message IDs — sortable, unique, time-ordered
- Extensible via
QueueInterfacefor adding custom backends
Installing
Requirements
- PHP >= 8.1
- Extensions:
sqlite3,bcmath
Optional Backend Dependencies
| Backend | Composer Package |
|---|---|
| LiteQueue (SQLite) | Built-in, no extra dependencies |
| RabbitMQ | composer require php-amqplib/php-amqplib |
| MongoDB | composer require mongodb/mongodb |
| Kafka | Requires ext-rdkafka PHP extension |
Quick Start
Producing Messages
Consuming Messages
Messages are consumed using PHP generators — no callbacks required.
Single Message Pull
Consumer Patterns
Multi-Queue Consumer
Listen to multiple queues simultaneously with round-robin iteration.
Blocking Handler
For simple workers that process messages with a callback.
Batch Processing
Process multiple messages per poll cycle for higher throughput.
Configuration
QueueConfig Properties
| Property | Type | Default | Description |
|---|---|---|---|
queueType |
string | 'litequeue' |
Backend type: litequeue, rabbitmq, mongo-queue, kafka |
litequeueDatabaseName |
string | 'queue.db' |
SQLite database file path |
rabbitmqConfig |
array|null | null |
RabbitMQ connection: host, port, user, password |
mongoQueueConfig |
array|null | null |
MongoDB connection: host, port, username, password |
kafkaConfig |
array|null | null |
Kafka config: bootstrap.servers, etc. |
prefix |
string | '' |
Namespace prefix for queue/topic names |
pollInterval |
float | 0.1 |
Seconds between polls when queue is empty |
maxBackoff |
float | 5.0 |
Maximum backoff ceiling (seconds) for exponential backoff |
Backend Configuration Examples
RabbitMQ
MongoDB
Kafka
Prefix Namespacing
Use the prefix property to isolate queue topics by environment.
QueueMessage Properties
Each consumed or produced message is a QueueMessage with readonly properties.
| Property | Type | Description |
|---|---|---|
messageId |
string | UUIDv7 — unique, time-sortable |
data |
string | The message payload |
userId |
string|null | Associated user identifier |
status |
int | 0 pending, 1 processing, 2 acknowledged |
timestamp |
int | Nanosecond timestamp (hrtime) |
deliveryTag |
string | Backend-specific delivery tag |
topic |
string | Queue topic name (for multi-queue consumers) |
Producer
The Producer wrapper provides a cleaner API that throws on failure instead of returning exceptions.
Backend Comparison
| Feature | LiteQueue | RabbitMQ | MongoDB | Kafka |
|---|---|---|---|---|
| External service | None | RabbitMQ broker | MongoDB server | Kafka cluster |
| Consume strategy | Exponential backoff poll | Event-driven (basic_consume) |
Exponential backoff poll | Timeout-based (consume) |
| Persistence | SQLite file | Broker (durable) | Document store | Commit log |
| Distributed | No | Yes | Yes | Yes |
| Message ordering | FIFO | FIFO | FIFO (sorted by in_time) |
Partitioned FIFO |
| Best for | Development, low volume | Reliable messaging | Document-oriented apps | High-throughput streaming |
Run Tests
All tests use LiteQueue with temporary SQLite databases — no external services required.
License
MIT — see LICENSE for details.
Our Sponsors
Sponsored with 🩵 by Code Infinity
Supporting open source communities • Innovate • Code • Empower
All versions of tina4php-queue with dependencies
ext-sqlite3 Version *
ext-bcmath Version *
tina4stack/tina4php-debug Version ^2.0
