{"id":15652075,"url":"https://github.com/wyrihaximus/reactphp-child-process-messenger","last_synced_at":"2025-04-04T20:11:13.161Z","repository":{"id":25539191,"uuid":"28971845","full_name":"WyriHaximus/reactphp-child-process-messenger","owner":"WyriHaximus","description":null,"archived":false,"fork":false,"pushed_at":"2024-10-04T03:14:05.000Z","size":638,"stargazers_count":31,"open_issues_count":23,"forks_count":14,"subscribers_count":5,"default_branch":"5.x","last_synced_at":"2024-10-29T21:07:30.676Z","etag":null,"topics":["child-process","cpu-offload","hacktoberfest","php","reactphp","rpc"],"latest_commit_sha":null,"homepage":null,"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/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":"2015-01-08T15:24:22.000Z","updated_at":"2024-05-09T17:32:57.000Z","dependencies_parsed_at":"2023-01-16T22:02:29.336Z","dependency_job_id":"f680c2c8-cbdb-47ef-bccb-a29072f3047e","html_url":"https://github.com/WyriHaximus/reactphp-child-process-messenger","commit_stats":{"total_commits":375,"total_committers":16,"mean_commits":23.4375,"dds":"0.16266666666666663","last_synced_commit":"7560ebaedba862ff94a418bf2e80925fc76c9208"},"previous_names":[],"tags_count":30,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WyriHaximus%2Freactphp-child-process-messenger","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WyriHaximus%2Freactphp-child-process-messenger/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WyriHaximus%2Freactphp-child-process-messenger/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/WyriHaximus%2Freactphp-child-process-messenger/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/WyriHaximus","download_url":"https://codeload.github.com/WyriHaximus/reactphp-child-process-messenger/tar.gz/refs/heads/5.x","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247242678,"owners_count":20907134,"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","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","cpu-offload","hacktoberfest","php","reactphp","rpc"],"created_at":"2024-10-03T12:41:14.244Z","updated_at":"2025-04-04T20:11:13.132Z","avatar_url":"https://github.com/WyriHaximus.png","language":"PHP","funding_links":["https://github.com/sponsors/WyriHaximus"],"categories":[],"sub_categories":[],"readme":"# ReactPHP Child Process Messenger\n\n[![Continuous Integration](https://github.com/WyriHaximus/reactphp-child-process-messenger/actions/workflows/ci.yml/badge.svg?event=push)](https://github.com/WyriHaximus/reactphp-child-process-messenger/actions/workflows/ci.yml)\n[![Latest Stable Version](https://poser.pugx.org/WyriHaximus/react-child-process-messenger/v/stable.png)](https://packagist.org/packages/WyriHaximus/react-child-process-messenger)\n[![Total Downloads](https://poser.pugx.org/WyriHaximus/react-child-process-messenger/downloads.png)](https://packagist.org/packages/WyriHaximus/react-child-process-messenger)\n[![Code Coverage](https://scrutinizer-ci.com/g/WyriHaximus/reactphp-child-process-messenger/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/WyriHaximus/reactphp-child-process-messenger/?branch=master)\n[![License](https://poser.pugx.org/WyriHaximus/react-child-process-messenger/license.png)](https://packagist.org/packages/wyrihaximus/react-child-process-messenger)\n\nPlain messages and RPC style wrapper around [`react/child-process`](https://github.com/reactphp/child-process). For pooling messengers take a look at [`wyrihaximus/react-child-process-pool`](https://github.com/WyriHaximus/reactphp-child-process-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-messenger \n```\n\n## Hassle less Example ##\n\nWhile this package supports several ways of setting up communication between parent and child the simplest way is to create class implementing `WyriHaximus\\React\\ChildProcess\\Messenger\\ChildInterface`. Up on calling `create` everything is set up and created to handle supported `RPC`'s and messages. \n\n```php\n\u003c?php\n\nuse React\\EventLoop\\LoopInterface;\nuse WyriHaximus\\React\\ChildProcess\\Messenger\\ChildInterface;\nuse WyriHaximus\\React\\ChildProcess\\Messenger\\Messages\\Payload;\n\nuse function React\\Promise\\resolve;\n\nfinal class ExampleChild implements ChildInterface\n{\n    public static function create(Messenger $messenger, LoopInterface $loop)\n    {\n        $messenger-\u003eregisterRpc('example', function (Payload $payload) {\n            return resolve($payload-\u003egetPayload());\n        });\n    }\n}\n```\n\nOn the parent side you only need to call to spawn a child running that class:\n\n```php\nMessengerFactory::parentFromClass('ExampleChild', $loop)-\u003ethen(static function (Messenger $messenger): void {\n    $messenger-\u003erpc(/* etc etc */);\n});\n```\n\n## More Examples ##\n\nFor both message and RPC examples see the [examples](https://github.com/WyriHaximus/reactphp-child-process-messenger/tree/master/examples) directory\n\n## Contributing ##\n\nPlease see [CONTRIBUTING](CONTRIBUTING.md) for details.\n\n## License ##\n\nCopyright 2021 [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-messenger","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwyrihaximus%2Freactphp-child-process-messenger","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwyrihaximus%2Freactphp-child-process-messenger/lists"}