Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/fdciabdul/multiprocess

Simple Multi Processing In PHP
https://github.com/fdciabdul/multiprocess

Last synced: 2 days ago
JSON representation

Simple Multi Processing In PHP

Awesome Lists containing this project

README

        

# MultiProcess
Simple Multi Processing In PHP

Install
`
composer require fdciabdul/multiprocess
`

Example

```php
$multi = new MultiThread();

$task1 = new Task(call_user_func(function() {
for ($i = 0; $i < 3; $i++) {
print "task 1: " . $i . "\n";
yield;
}
// start by executing this
}));

$task2 = new Task(call_user_func(function() {
for ($i = 0; $i < 6; $i++) {
print "task 2: " . $i . "\n";
yield;
}
// then start this one
}));

$multi->enqueue($task1);
$multi->enqueue($task2);

$multi->run();
```