{"id":33963915,"url":"https://github.com/kongxinchi/jorker","last_synced_at":"2026-03-11T06:31:41.475Z","repository":{"id":57001484,"uuid":"90839050","full_name":"kongxinchi/jorker","owner":"kongxinchi","description":"PHP Run jobs with multi process. | PHP脚本多进程执行","archived":false,"fork":false,"pushed_at":"2017-11-24T06:51:15.000Z","size":24,"stargazers_count":13,"open_issues_count":0,"forks_count":2,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-12-14T11:41:01.694Z","etag":null,"topics":["fork","jobs","multiprocess","php","script"],"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/kongxinchi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-05-10T08:18:54.000Z","updated_at":"2024-05-20T07:41:43.000Z","dependencies_parsed_at":"2022-08-21T11:40:46.381Z","dependency_job_id":null,"html_url":"https://github.com/kongxinchi/jorker","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/kongxinchi/jorker","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kongxinchi%2Fjorker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kongxinchi%2Fjorker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kongxinchi%2Fjorker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kongxinchi%2Fjorker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kongxinchi","download_url":"https://codeload.github.com/kongxinchi/jorker/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kongxinchi%2Fjorker/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30373454,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-11T06:09:32.197Z","status":"ssl_error","status_checked_at":"2026-03-11T06:09:17.086Z","response_time":84,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["fork","jobs","multiprocess","php","script"],"created_at":"2025-12-12T22:51:36.507Z","updated_at":"2026-03-11T06:31:41.125Z","avatar_url":"https://github.com/kongxinchi.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Jorker\nRun jobs with multi process. | 脚本多进程执行\n\n## Features\n* Execute script with multi process. 脚本多进程执行\n* Continue last job that last time stopped. 支持中断续运行\n* Memory overload protection. 内存过载保护\n* Timing report progress. 定时报告进度\n* Highly configurable. 高度可配置\n\n## Fixme\n* 已知问题：主进程中有数据库连接时，在子进程退出时会将连接析构，导致主进程中连接失效。\n\n## Setup\n    composer require jorker/jorker\n\n## Usage\n    \u003c?php\n      require_once(dirname(__DIR__) . '/vendor/autoload.php');\n\n      $manager = new \\Jorker\\JobForker(3);\n      $manager-\u003eallot(function() {\n      \n          // RETURN OR YIELD JOBS IN MASTER PROCESS...\n          for($i = 0; $i \u003c 100; $i++) {\n              yield ['i' =\u003e $i];\n          }\n          \n      })-\u003erun(function($job, \\Jorker\\Slave\\Slave $slave) {\n      \n          // DO SOMETHING IN SUB PROCESS...\n          $slave-\u003elogger()-\u003einfo(\"use this way if you want print log {$job['i']}.\");\n          \n      });\n      \n## Options\n    \\Jorker\\JobForker::__construct($limit, $options)\n    \n      @param int $limit | Sub process limit. 使用多少个子进程\n      @param array $options | configs. 配置项\n        [\n          \"logger\" =\u003e new SimpleEchoLogger(),     // LoggerInterface. 日志接口\n          \"logLevel\" =\u003e LogLevel::INFO,           // Print log which level greater or equal. 打印日志的最低等级\n          \"slaveMaxMemory\" =\u003e 256*1024*1024,      // Sub process max memory, if over this value, master will stop this sub process and fork a new one. 子进程最大内存，超出该内存终止子进程，终止后父进程会重新fork一个新的子进程\n          \"reportInterval\" =\u003e 600,                // Execute report handler every {reportInterval} seconds. 运行指定秒数后，对运行时统计进行报告\n          \"reportHandler\" =\u003e functuin() {echo \"REPORT\";},  // Execute report handle. 回调函数，运行时统计报告\n          \"stampFilePath\" =\u003e \"/tmp/stamp.dat\",    // File path that save last job when user CTRL+C stopped script. 用于记录上一次中断时，即将执行数据的保存路径\n        ]\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkongxinchi%2Fjorker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkongxinchi%2Fjorker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkongxinchi%2Fjorker/lists"}