Download the PHP package yidas/worker-dispatcher without Composer

On this page you can find all versions of the php package yidas/worker-dispatcher. 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 worker-dispatcher

PHP Worker Dispatcher


PHP multi-processing task dispatcher with managing workers

Latest Stable Version License

Features


OUTLINE


DEMONSTRATION

Use multi-processing to dispatch tasks with generating workers based on CPU cores:

Use multi-processing to digest jobs from queue:


INTRODUCTION

This library is implemented by PHP PCNTL control, which provides a main PHP-CLI to fork multiple child processes to share tasks, and even can use for high concurrency application with infinite loop setting.

Since PHP has no shared variables or queue mechanism natively, if you don’t have an external job queue, this library provides a task average dispatcher to simply solve the core distributed processing problem.


REQUIREMENTS

This library requires the following:


INSTALLATION

Run Composer in your project:

composer require yidas/worker-dispatcher ~1.0.0

Then you could use the class after Composer is loaded on your PHP project:


USAGE

Calling the run() method statically with options as argument, WorkerDispatcher will start to dispatch tasks (if any), and then fork the number of workers according to the environment or settings, and wait for all forked processes to complete or terminate the main process.

The setting example with all options is as following:

Options

Option Type Deafult Description
debug boolean false Debug mode
workers integer (auto) The number of workers(processes) to fork.
(The default is the same as the number of CPU cores)
config multitype null The custom variable used to bring in the callback function
tasks multitype array For dispatching to each forked process.
- Array: Each value of array will be dispatched to all forked processes.
- Integer: The number of loops dispatched to all forked processes.
- false: Perform finite loop.
callbacks.process callable nul Callback function called after each forked process is created
callbacks.task callable nul Callback function called in each task loop of each forked process

callbacks.process

Callback function called after each forked process is created

Argument Type Deafult Description
$config multitype null The custom variable used to bring in the callback function
$workerId integer (auto) The sequence number of the worker(processes) in current function (Start from 1)
$tasks multitype array Tasks array list for the worker(processes) in current function

callbacks.task

Callback function called in each task loop of each forked process

Argument Type Deafult Description
$config multitype null The custom variable used to bring in the callback function
$workerId integer (auto) The sequence number of the worker(processes) in current function (Start from 1)
$tasks multitype array The value of each tasks array list for each worker(processes) in current function

All versions of worker-dispatcher with dependencies

PHP Build Version
Package Version
Requires php Version >=5.4
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 yidas/worker-dispatcher contains the following files

Loading the files please wait ....