{"id":19217077,"url":"https://github.com/shellvon/multiprocessing","last_synced_at":"2026-06-10T21:32:09.581Z","repository":{"id":71590717,"uuid":"72339924","full_name":"shellvon/multiprocessing","owner":"shellvon","description":"[DEPRECTED] A Lightweight MultiProcessing Library for PHP","archived":false,"fork":false,"pushed_at":"2016-11-01T09:29:39.000Z","size":26,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-11-13T21:23:21.348Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/shellvon.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-10-30T09:21:13.000Z","updated_at":"2018-01-07T05:26:51.000Z","dependencies_parsed_at":"2023-03-15T18:03:00.707Z","dependency_job_id":null,"html_url":"https://github.com/shellvon/multiprocessing","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/shellvon/multiprocessing","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shellvon%2Fmultiprocessing","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shellvon%2Fmultiprocessing/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shellvon%2Fmultiprocessing/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shellvon%2Fmultiprocessing/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shellvon","download_url":"https://codeload.github.com/shellvon/multiprocessing/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shellvon%2Fmultiprocessing/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34172196,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-10T02:00:07.152Z","response_time":89,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-09T14:20:01.843Z","updated_at":"2026-06-10T21:32:09.557Z","avatar_url":"https://github.com/shellvon.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# multiprocessing\n\n###[English Doc](./README_EN.md) [Change Log](./CHANGELOG.md)\n一个非常非常轻量级的多进程处理的PHP框架。目前使用共享内存/信号量进行进程间通信(IPC)\n\n# 特性\n\n- 轻松创建多进程,不用担心IPC问题\n- worker使用观察者模式,支持注册worker的开始/重试/成功/失败等事件。比如在重试的时候修改worker属性\n- worker支持重试机制.(立即重试/放入队列稍后重试)\n- API简单,用户实现自己在process中的业务逻辑\n- 方便扩展,用户可以自己实现自己比如DB相关的数据队列(实现`MultiProcessing\\Contracts\\Queue`)\n- 我想不到了\n\n# 快速开始\n\n## 环境要求\n\n该项目在PHP5.6,Mac OS下开发,但是没有使用[]表示数组/yield关键字等PHP高版本的语法特性，理论上PHP5.3+都支持。\n\n- Linux/MacOS\n- PHP 5.3+ (Not PHP7) with `-enable-pcntl` and `--enable-sysvshm`\n- [Composer](https://getcomposer.org/)\n\n## 使用步骤\n\n如果需要自己创建一个多进程任务，你需要几分钟完成以下工作(比起自己去创建/管理多进程来说这个时间很短啦)\n\n1. 参见`demo/BaiduCrawler.php`, 将你自己的worker类继承`\\MultiProcessing\\Worker`即可,并且同时实现`process`方法。需要注意的是实现process方法时候，请返回实现了`MultiProcessing\\Contracts\\Response`的类型，否则worker将把自动转为类型为`JobResponse`(该类实现了`MultiProcessing\\Contracts\\Response`接口)\n2. 添加自己喜欢的Listener回调,比如`JobEvent::JOB_SUCCESS`之类的。\n3. 调用`\\MultiProcessing\\Process\\Process`并且设置好进程数量;然后调用`map`这个API即可。\n\n当然，你可以自己查看demo目录下的代码\n\n\n\n# 代码结构\n\n```\nmultiprocessing-+\n                |--demo-+\n                |       |--BaiduCrawler.php // Curl爬百度首页的演示代码\n                |       |--Sums.php         // 求和的演示代码\n        \t\t|       |--demo.php         // 演示代码,执行php demo.php 看效果\n                |       |--clearIPC.py      // MacOS下清理共享数据的python脚本\n                |\n                |\n                |--src--+                    //核心文件目录\n                |       |--BootStrap-+\n                |       |            |--Autoloader.php  // 自动加载\n                |       |--Contract-+\n                |       |           |--//各种接口，高级用户需要自己实现某些接口以完成任务\n                |       |--Events-+\n                |       |\t\t  |--JobEvents.php    // 任务事件.用于事件监听\n                |       |--Process-+\n                |       |          |--Process.php     // 多进程管理相关文件\n                |       |--Queue-+\n                | \t\t|\t\t |--SharedMemQueue.php // 利用共享内存实现的队列\n                |       |     \t |--NullQueue.php      // 空队列，啥也不做\n                |\t\t|--Response-+\n                |       |           |--JobResponse.php\n                |       |--Strategy-+\n                |       |           |--RetryStrategy.php // 重试策略.\n                |       |--Worker.php  // Worker类，用户需要继承然后实现它的process方法\n                |--vendor              //Composer管理的第三方库\n```\n\n\n\n# TODO\n\n:smile: 等我想想 …..\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshellvon%2Fmultiprocessing","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshellvon%2Fmultiprocessing","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshellvon%2Fmultiprocessing/lists"}