Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/wyrihaximus/reactphp-child-process-messenger
https://github.com/wyrihaximus/reactphp-child-process-messenger
child-process cpu-offload hacktoberfest php reactphp rpc
Last synced: 4 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/wyrihaximus/reactphp-child-process-messenger
- Owner: WyriHaximus
- License: mit
- Created: 2015-01-08T15:24:22.000Z (about 10 years ago)
- Default Branch: 5.x
- Last Pushed: 2024-10-04T03:14:05.000Z (4 months ago)
- Last Synced: 2024-10-29T21:07:30.676Z (3 months ago)
- Topics: child-process, cpu-offload, hacktoberfest, php, reactphp, rpc
- Language: PHP
- Size: 623 KB
- Stars: 31
- Watchers: 5
- Forks: 14
- Open Issues: 23
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
# ReactPHP Child Process Messenger
[![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)
[![Latest Stable Version](https://poser.pugx.org/WyriHaximus/react-child-process-messenger/v/stable.png)](https://packagist.org/packages/WyriHaximus/react-child-process-messenger)
[![Total Downloads](https://poser.pugx.org/WyriHaximus/react-child-process-messenger/downloads.png)](https://packagist.org/packages/WyriHaximus/react-child-process-messenger)
[![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)
[![License](https://poser.pugx.org/WyriHaximus/react-child-process-messenger/license.png)](https://packagist.org/packages/wyrihaximus/react-child-process-messenger)Plain 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)
### Installation ###
To install via [Composer](http://getcomposer.org/), use the command below, it will automatically detect the latest version and bind it with `~`.
```
composer require wyrihaximus/react-child-process-messenger
```## Hassle less Example ##
While 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.
```php
registerRpc('example', function (Payload $payload) {
return resolve($payload->getPayload());
});
}
}
```On the parent side you only need to call to spawn a child running that class:
```php
MessengerFactory::parentFromClass('ExampleChild', $loop)->then(static function (Messenger $messenger): void {
$messenger->rpc(/* etc etc */);
});
```## More Examples ##
For both message and RPC examples see the [examples](https://github.com/WyriHaximus/reactphp-child-process-messenger/tree/master/examples) directory
## Contributing ##
Please see [CONTRIBUTING](CONTRIBUTING.md) for details.
## License ##
Copyright 2021 [Cees-Jan Kiewiet](http://wyrihaximus.net/)
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.