fdciabdul / multiprocess
PHP Multi Processing
dev-main
2021-03-25 07:23 UTC
This package is auto-updated.
Last update: 2024-09-25 14:55:51 UTC
README
Simple Multi Processing In PHP
Install
composer require fdciabdul/multiprocess
Example
$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();