{"id":15029113,"url":"https://github.com/wyrihaximus/reactphp-child-process-closure","last_synced_at":"2025-09-09T08:47:45.130Z","repository":{"id":21399720,"uuid":"92622197","full_name":"WyriHaximus/reactphp-child-process-closure","owner":"WyriHaximus","description":"Run closures in a child process messenger or pool","archived":false,"fork":false,"pushed_at":"2025-08-08T16:58:54.000Z","size":394,"stargazers_count":6,"open_issues_count":4,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-08-17T07:38:09.112Z","etag":null,"topics":["child-process","closure","cpu-offload","hacktoberfest","php","php7","reactphp"],"latest_commit_sha":null,"homepage":null,"language":"Makefile","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/WyriHaximus.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"WyriHaximus"}},"created_at":"2017-05-27T20:23:35.000Z","updated_at":"2022-01-10T23:13:44.000Z","dependencies_parsed_at":"2023-12-05T00:43:16.481Z","dependency_job_id":null,"html_url":"https://github.com/WyriHaximus/reactphp-child-process-closure","commit_stats":{"total_commits":54,"total_committers":6,"mean_commits":9.0,"dds":0.6111111111111112,"last_synced_commit":"39bcceccd6722ac627bceafaad4f29114e34b130"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/WyriHaximus/reactphp-child-process-closure","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WyriHaximus%2Freactphp-child-process-closure","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WyriHaximus%2Freactphp-child-process-closure/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WyriHaximus%2Freactphp-child-process-closure/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WyriHaximus%2Freactphp-child-process-closure/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/WyriHaximus","download_url":"https://codeload.github.com/WyriHaximus/reactphp-child-process-closure/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WyriHaximus%2Freactphp-child-process-closure/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274268373,"owners_count":25253390,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-09T02:00:10.223Z","response_time":80,"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":["child-process","closure","cpu-offload","hacktoberfest","php","php7","reactphp"],"created_at":"2024-09-24T20:09:45.315Z","updated_at":"2025-09-09T08:47:45.103Z","avatar_url":"https://github.com/WyriHaximus.png","language":"Makefile","funding_links":["https://github.com/sponsors/WyriHaximus"],"categories":[],"sub_categories":[],"readme":"# ReactPHP Child Process Messenger/Pool Closure child class\n\n[![Linux Build Status](https://travis-ci.org/WyriHaximus/reactphp-child-process-closure.png)](https://travis-ci.org/WyriHaximus/reactphp-child-process-closure)\n[![Latest Stable Version](https://poser.pugx.org/WyriHaximus/react-child-process-closure/v/stable.png)](https://packagist.org/packages/WyriHaximus/react-child-process-closure)\n[![Total Downloads](https://poser.pugx.org/WyriHaximus/react-child-process-closure/downloads.png)](https://packagist.org/packages/WyriHaximus/react-child-process-closure)\n[![Code Coverage](https://scrutinizer-ci.com/g/WyriHaximus/reactphp-child-process-closure/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/WyriHaximus/reactphp-child-process-closure/?branch=master)\n[![License](https://poser.pugx.org/WyriHaximus/react-child-process-closure/license.png)](https://packagist.org/packages/wyrihaximus/react-child-process-closure)\n[![PHP 7 ready](http://php7ready.timesplinter.ch/WyriHaximus/reactphp-child-process-closure/badge.svg)](https://travis-ci.org/WyriHaximus/reactphp-child-process-closure)\n\nRun closures in a child process messenger or pool\n\n### Installation ###\n\nTo install via [Composer](http://getcomposer.org/), use the command below, it will automatically detect the latest version and bind it with `~`.\n\n```\ncomposer require wyrihaximus/react-child-process-closure \n```\n\n## Usage ##\n\nRun a closure on the child process and get the results. (Note that results have to be a JSON serializable array.) \n\n```php\nuse React\\EventLoop\\Factory as EventLoopFactory;\nuse WyriHaximus\\React\\ChildProcess\\Closure\\ClosureChild;\nuse WyriHaximus\\React\\ChildProcess\\Closure\\MessageFactory;\nuse WyriHaximus\\React\\ChildProcess\\Messenger\\Factory as MessengerFactory;\nuse WyriHaximus\\React\\ChildProcess\\Messenger\\Messages\\Payload;\nuse WyriHaximus\\React\\ChildProcess\\Messenger\\Messenger;\n\n$loop = EventLoopFactory::create();\n\nMessengerFactory::parentFromClass(ClosureChild::class, $loop)-\u003ethen(function (Messenger $messenger) use ($loop) {\n    $messenger-\u003erpc(MessageFactory::rpc(function () {\n        return resolve(['time' =\u003e time()]);\n    })-\u003edone(function (Payload $payload) {\n        echo 'Time in the child process: ', $payload['time'], PHP_EOL;\n    });\n});\n\n$loop-\u003erun();\n```\n\nThe usage example above also works with [`wyrihaximus/react-child-process-pool`](https://github.com/wyrihaximus/reactphp-child-process-pool#flexible), just be sure to use `WyriHaximus\\React\\ChildProcess\\Closure\\MessageFactory` to create the RPC messages as shown in the example.\n\n## Examples ##\n\nFor more examples see the [examples](https://github.com/WyriHaximus/reactphp-child-process-closure/tree/master/examples) directory\n\n## Contributing ##\n\nPlease see [CONTRIBUTING](CONTRIBUTING.md) for details.\n\n## License ##\n\nCopyright 2017 [Cees-Jan Kiewiet](http://wyrihaximus.net/)\n\nPermission is hereby granted, free of charge, to any person\nobtaining a copy of this software and associated documentation\nfiles (the \"Software\"), to deal in the Software without\nrestriction, including without limitation the rights to use,\ncopy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the\nSoftware is furnished to do so, subject to the following\nconditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES\nOF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\nNONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\nHOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\nWHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\nFROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR\nOTHER DEALINGS IN THE SOFTWARE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwyrihaximus%2Freactphp-child-process-closure","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwyrihaximus%2Freactphp-child-process-closure","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwyrihaximus%2Freactphp-child-process-closure/lists"}