Download the PHP package white-rabbit-1-sketch/php-worker-pool without Composer

On this page you can find all versions of the php package white-rabbit-1-sketch/php-worker-pool. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package php-worker-pool

PHP Worker Pool

Latest Version Phpunit codecov

A lightweight PHP library for managing worker pools with shared memory and task queues using System V Message Queues and Redis.

Table of Contents

  1. Features
  2. Quick Start
    • Installation
    • Examples
      • SysV Queue (Infinite Loop)
      • Redis Queue (Infinite Loop)
      • SysV Queue (Fixed Loop)
      • Redis Queue (Fixed Loop)
  3. Queue Types
    • SysV Message Queues
    • Redis Queue
    • Creating Custom Queues
  4. Modes of Operation
    • Infinite Loop (Default)
    • Fixed Loop
  5. How It Works
    • System V Queues
    • Queue Implementation
  6. Who This Library Is For
    • Why Choose This Library?
    • Use Cases
    • Comparison with Other Solutions
  7. Author and License

Features


Quick Start

Installation

To install the PHP Worker Pool library, use Composer:

  1. If you haven't already, install Composer on your system.
  2. Run the following command to install the library:

Examples

Example for Sys V Queue with infinite loop:

Example for Redis Queue with infinite loop:

Example for Sys V Queue with fixed loop:

Example for Redis Queue with fixed loop:


Queue Types

The library provides two queue types that you can use to store and manage tasks:

1. SysV Message Queues

Key Features:

2. Redis Queue

Key Features:

3. Creating Custom Queues

While the library comes with two built-in queue implementations (SysV and Redis), it is also flexible enough to allow you to create your own custom queue. You can implement a queue using any storage mechanism that you prefer (e.g., databases, files, etc.).

Modes of Operation

This library supports two operating modes for processing tasks in the queue:

1. Infinite Loop (Default Mode)

2. Fixed Loop

How It Works

The library leverages System V message queues (using the sysvmsg PHP extension) or Redis to enable efficient communication between processes. Each queue is identified by a unique key and allows processes to exchange serialized messages.

Key Features of System V Message Queues

Queue Implementation


Who This Library Is For

The PHP Worker Pool library is designed for developers who need a lightweight, efficient, and simple solution for parallel task processing in PHP applications. Unlike existing solutions that require complex infrastructure setups, such as supervisors, message brokers (e.g., RabbitMQ), databases, or dedicated workers (e.g., Symfony Messenger), this library provides a straightforward and lightweight approach to task parallelism.

Why Choose This Library?

  1. Minimal Infrastructure Requirements
    Unlike solutions like Symfony Messenger, which rely on external systems like RabbitMQ, database queues, or a distributed message broker, this library operates entirely within PHP processes using System V Message Queues or Redis queues. There's no need to set up complex messaging infrastructure, run external services, or manage dedicated workers.

  2. Ease of Setup and Maintenance
    This library can be integrated into PHP applications with minimal configuration changes. It leverages System V Message Queues or Redis as a local inter-process communication mechanism, allowing you to start processing tasks with just a few lines of code. Perfect for small to medium-scale PHP applications where complex systems like Supervisors, microservices, or heavy infrastructure are overkill.

  3. High Performance and Low Overhead
    By forking worker processes once and reusing them, this library allows you to manage task processing with minimal context switching and overhead. The task queue is managed directly within the PHP process space, resulting in faster task processing and lower memory consumption compared to traditional PHP worker pools that rely on external systems.

  4. Scalable and Efficient Local Task Processing
    For many PHP applications, local task processing (e.g., within a single server or a set of PHP CLI scripts) is sufficient. This library is perfect for scenarios where the PHP environment can handle concurrency and resource management without the need for a distributed queue system.

  5. Lightweight Parallel Processing
    This library strikes a balance between lightweight parallel processing and task isolation. It is ideal for scenarios where tasks need to run in parallel but don’t require distributed coordination, cross-process messaging, or high-level task execution guarantees.

  6. Limited but Focused Flexibility
    Compared to more sophisticated solutions like RabbitMQ or Symfony Messenger, this library’s task processing model is more restrictive. It does not offer complex message routing, event listeners, or asynchronous messaging. However, it is perfect for straightforward task processing like handling I/O-bound operations, background data processing, file generation, or network requests.

  7. Use Cases:
    • Short-lived tasks that don’t require persistent state across runs (e.g., file processing, HTTP request handling, data transformations).
    • Small-scale parallel tasks in PHP CLI scripts (e.g., running parallel data processing operations).
    • Local task queues where tasks are processed in the same process space.
    • Cron jobs or background processing tasks where simple task coordination and local memory access are sufficient.

Comparison with Other Solutions

Summary

By choosing this library, developers can take advantage of high-performance task processing with minimal configuration overhead, local resource management, and efficient concurrency, without the need to rely on external systems or complex message queues. This makes it an ideal choice for many PHP-based applications looking for simple, efficient, and lightweight task processing.

Author and License

Author: Mikhail Chuloshnikov

License: MIT License

This library is released under the MIT License. See the LICENSE file for more details.


All versions of php-worker-pool with dependencies

PHP Build Version
Package Version
Requires opis/closure Version ^3.6
predis/predis Version ^2.3
malkusch/lock Version ^2.2
php Version ^8.1
ext-pcntl Version *
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package white-rabbit-1-sketch/php-worker-pool contains the following files

Loading the files please wait ....