Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kriswallsmith/spork
Experimental library for forking PHP
https://github.com/kriswallsmith/spork
Last synced: 3 months ago
JSON representation
Experimental library for forking PHP
- Host: GitHub
- URL: https://github.com/kriswallsmith/spork
- Owner: kriswallsmith
- License: mit
- Created: 2012-04-10T03:31:04.000Z (about 12 years ago)
- Default Branch: master
- Last Pushed: 2016-03-17T13:22:16.000Z (over 8 years ago)
- Last Synced: 2024-03-29T16:02:49.219Z (3 months ago)
- Language: PHP
- Homepage:
- Size: 372 KB
- Stars: 588
- Watchers: 34
- Forks: 52
- Open Issues: 25
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Lists
- awesome-php-zh_CN - Spork - 一个处理forking的库 (杂项 Miscellaneous)
- awesome-php-cn - 官网
- awesome-php - Spork - A process forking library. (Miscellaneous)
- awesome-php-cn - 官网
- awesome-php-new - Spork - A process forking library. (Configuration / Miscellaneous)
- awesome-php - Spork - A process forking library. (Miscellaneous)
- awesome-php - Spork - A process forking library. (Configuration / Miscellaneous)
- awesome-php - Spork - A process forking library. (Configuration / Miscellaneous)
- PHP_awesome-directus-duh-REKT-iss- - Spork - A process forking library. (Configuration / Miscellaneous)
- awesome-stripe - Spork - A process forking library. (Configuration / Miscellaneous)
- awesome-php - Spork - A process forking library. (Configuration / Miscellaneous)
README
[![Build Status](https://secure.travis-ci.org/kriswallsmith/spork.png?branch=master)](http://travis-ci.org/kriswallsmith/spork)
Spork: PHP on a Fork
--------------------```php
fork(function() {
// do something in another process!
return 'Hello from '.getmypid();
})->then(function(Spork\Fork $fork) {
// do something in the parent process when it's done!
echo "{$fork->getPid()} says '{$fork->getResult()}'\n";
});
```### Example: Upload images to your CDN
Feed an iterator into the process manager and it will break the job into
multiple batches and spread them across many processes.```php
process($files, function(SplFileInfo $file) {
// upload this file
});
```