Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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
- Host: GitHub
- URL: https://github.com/fdciabdul/multiprocess
- Owner: fdciabdul
- Created: 2021-02-04T07:22:22.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2021-03-25T07:23:03.000Z (over 3 years ago)
- Last Synced: 2024-05-01T16:30:07.555Z (5 months ago)
- Language: PHP
- Size: 5.86 KB
- Stars: 3
- Watchers: 3
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# MultiProcess
Simple Multi Processing In PHPInstall
`
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();
```