2017 © Pedro Peláez
 

library multitasking

image

oasis/multitasking

  • Thursday, September 28, 2017
  • by no7mks
  • Repository
  • 6 Watchers
  • 1 Stars
  • 671 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 2 Open issues
  • 11 Versions
  • 4 % Grown

The README.md

php-multitasking

Multitasking support for PHP, using pcntl library to fork children processes, (*1)

Installation

oasis/multitasking is an open-source component available at packagist.org. To require the package, try the following in your project directory:, (*2)

composer require oasis/multitasking

Background Worker Manager

If you ever want to run something in the background(i.e. a callable that is often referred to as worker), you should have a look at BackgroundWorkerManager class. This class provides the following features:, (*3)

  • Run multiple workers in the background (forked process)
  • An ordered worker queue which limits the concurrent running worker to a preset number
  • Wait functionality for the parent process

Example:, (*4)

<?php

$man = new BackgroundWorkerManager(2);
$man->addWorker(
    function (WorkerInfo $info) {
        echo sprintf(
            "This is the #%d worker executed out of a total of %d",
            $info->currentWorkerIndex,
            $info->totalWorkers
            );
    },
    10
    ); // add 10 workers to the manager

$man->run(); // all workers will be executed in order, no more than 2 workes will be running at the same time

$man->wait();

The Versions

28/09 2017

dev-master

9999999-dev

  Sources   Download

MIT

The Requires

 

The Development Requires

by Minhao Zhang

28/09 2017

v1.3.1

1.3.1.0

  Sources   Download

MIT

The Requires

 

The Development Requires

by Minhao Zhang

07/09 2017

1.3.0

1.3.0.0

  Sources   Download

MIT

The Requires

 

The Development Requires

by Minhao Zhang

05/09 2017

v1.2.0

1.2.0.0

  Sources   Download

MIT

The Requires

 

The Development Requires

by Minhao Zhang

28/06 2017

v1.1.1

1.1.1.0

  Sources   Download

MIT

The Requires

 

The Development Requires

by Minhao Zhang

06/06 2017

v1.1.0

1.1.0.0

  Sources   Download

MIT

The Requires

 

The Development Requires

by Minhao Zhang

26/09 2016

v1.0.3

1.0.3.0

  Sources   Download

MIT

The Requires

 

The Development Requires

by Minhao Zhang

26/09 2016

v1.0.2

1.0.2.0

  Sources   Download

MIT

The Requires

 

The Development Requires

by Minhao Zhang

01/09 2016

v1.0.1

1.0.1.0

  Sources   Download

MIT

The Requires

 

The Development Requires

by Minhao Zhang

31/08 2016

v1.0.0

1.0.0.0

  Sources   Download

MIT

The Requires

 

The Development Requires

by Minhao Zhang

31/08 2016

v1.0.0-beta1

1.0.0.0-beta1

  Sources   Download

MIT

The Requires

 

The Development Requires

by Minhao Zhang