Download the PHP package guycalledseven/job-queue without Composer
On this page you can find all versions of the php package guycalledseven/job-queue. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package job-queue
JobQueue
Overview
JobQueue is a pluggable job queue library with two interchangeable engines: a concurrent, high-performance SQLite backend for scalable workloads, and a pure-CSV backend where the queue itself is the CSV file. Includes CSV import/export adapters with aliases, transforms, and flexible schema mapping.
It allows importing, processing, and exporting structured data/tasks from CSV files while maintaining full state persistence across runs.
Project was created over a weekend because I needed a way to run long reports on a large CSV files where each row included long running tasks that can fail and should be resumable. I wanted zero dependencies and to keep compatiblity for php 7.4 upwards.
Typical Use Cases
-
Persistent batch processing pipeline.
-
CSV-to-database ingestion with resumable progress.
-
Scheduled or restartable job execution.
-
Converting input CSVs to normalized datasets with flexible export mapping.
-
Maintaining processing metadata (status, errors, timestamps) outside the original CSV.
- You cannot / do not wan't to install any queue server software and bring additioonal dependencies
Features
-
SQLite-backed queue
-
Atomic fetch, process, and update of jobs.
-
Durable state storage across restarts.
-
Automatic recovery of
in_progressrows after interruption. - O(1) row updates, WAL + synchronous=NORMAL, single-writer fast path.
-
-
CSV-backed queue
-
It uses input CSV as a queue it self
-
Suitable for huge and slower batches.
- Correct but I/O heavy for fast jobs (two full writes per job if you mark on fetch and on complete).
-
-
CSV import and export
-
Reads semicolon-delimited files with flexible headers.
-
Writes consistent output CSVs with selectable columns.
- Preserves custom or unknown columns as JSON in an
extrasfield.
-
-
Profile-driven mapping
-
Customizable header aliases, default values, and transforms.
-
Controlled import/export column sets via
CsvProfile. - Optional normalization for booleans, statuses, and timestamps.
-
-
Selective synchronization
-
updateCoreflag allows either full state import or extras-only merge. - Merges new data with existing records without overwriting unmodified fields.
-
-
Progress tracking
-
Built-in methods for counting queued, processed, and failed jobs.
- Progress and error summaries available through helper functions.
-
-
Database maintenance
-
Vacuum and analyze utilities for compaction.
- Safe deletion or full reset via table drop or file removal.
-
-
Extras handling
-
Arbitrary extra columns are preserved as JSON.
-
Automatically merged on repeated imports.
- Fully exportable through profile configuration.
-
-
Single-writer performance
-
Optimized SQLite pragmas (
WAL,synchronous=NORMAL, memory temp store). - Transactions batched for fast bulk imports.
-
Components
-
SqliteQueue— core engine for persistent job management. DB lifecycle, fetch, mark, progress, reset. Writes .sqlite files on disk in specified location. -
CsvQueue— CSV-backed engine - uses CSV file as a queue it self. Correct but I/O heavy. For huge and slower jobs. -
CsvProfile— schema mapping for CSV import/export: aliases, transforms, defaults, export columns and labels. -
CsvImporter— imports CSV into the queue via aCsvProfile. OptionalupdateCoreto restore state. -
CsvExporter— exports queue state to CSV via aCsvProfile. BatchableQueueInterface— minimal contract both engines implement:fetchNext(),markSuccess(),markFailure(),resetAll(),progress().
Import modes
-
updateCore=false(default): import only IDs and extras. Core state in DB is preserved. Extras are merged, never wiped. updateCore=trueupdate core fields only if present in the CSV header; extras are merged. Use this to restore prior runs.
Install / Autoload
Install: composer require guycalledseven/job-queue
Autoload: PSR-4 "guycalledseven\JobQueue\": "src/Queue/"
PHP: 7.4+ (I have my reasons) 😅
Examples
Engines and swapping
Simple csv example
Example input data:
Example output:
Usage:
Complex example with transforms
Input csv data:
Output csv:
Code
CsvQueue
The point of this implementation is to keep things simple, without any external dependencies or additional engines (like MySQL, Redis, Rabbit MQ etc.).
The CSV file which is being processed is the queue itself.
CsvQueue example
License
MIT License.