Skip to content

A PHP helper to fork processes and allow multi-threading

License

Notifications You must be signed in to change notification settings

ihalton/fork-helper

 
 

Repository files navigation

fork-helper

Simple class to fork processes in PHP and allow multi-threading.

Full documentation is available at http://duncan3dc.github.io/fork-helper/
PHPDoc API documentation is also available at http://duncan3dc.github.io/fork-helper/api/

Build Status Latest Stable Version

Quick Example

Run some code asynchronously:

$fork = new \duncan3dc\Forker\Fork;

$fork->call(function () {
    for ($i = 1; $i <= 3; $i++) {
        echo "Process A - " . $i . "\n";
        sleep(1);
    }
});
$fork->call(function () {
    for ($i = 1; $i < 3; $i++) {
        echo "Process B - " . $i . "\n";
        sleep(1);
    }
});

sleep(1);
echo "Waiting for the threads to finish...\n";
$fork->wait();
echo "End\n";

Read more at http://duncan3dc.github.io/fork-helper/

Changelog

A Changelog has been available since version 2.0.0

Where to get help

Found a bug? Got a question? Just not sure how something works?
Please create an issue and I'll do my best to help out.
Alternatively you can catch me on Twitter

About

A PHP helper to fork processes and allow multi-threading

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 99.0%
  • Shell 1.0%