Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/larrythecoder/php-grpc-library
gRPC library for PHP
https://github.com/larrythecoder/php-grpc-library
Last synced: 19 days ago
JSON representation
gRPC library for PHP
- Host: GitHub
- URL: https://github.com/larrythecoder/php-grpc-library
- Owner: larryTheCoder
- License: apache-2.0
- Created: 2023-07-24T18:03:46.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-11-14T06:48:00.000Z (about 1 year ago)
- Last Synced: 2024-04-16T11:07:15.900Z (7 months ago)
- Language: PHP
- Size: 232 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# PHP-gRPC library
Unofficial work of PHP gRPC implementation for asynchronous calls. The implementation is taken from @arnaud-lb [php-async](https://github.com/arnaud-lb/grpc/tree/php-async) branch.
Here lies the documentation to interact with my own [grpc binding](https://github.com/larryTheCoder/php-grpc) library.
### Asynchronous calls
PHP does not have an event-loop, therefore user-space event loop is required to check if a call is completed. The following must be called periodically:```php
Call::drainCompletionQueue(PHP_INT_MIN);
```The first parameter specifies the time to wait for any queue to complete. In this case, the completion queue will check if [any calls is complete once](https://github.com/larryTheCoder/php-grpc/blob/main/src/completion_queue.c#L49-L76).
### Client gRPC calls
To establish a bidirectional call, user must wait for the connection to be established to the remote server before sending any messages.
This can be achieved by providing a callback to `ClientCallInterface::onClientReady(Closure)`.
Alternatively, `ClientCallInterface::isReady()` can be used to check if the call is ready to send any message to the remote server.| [ClientStreamingCall](https://github.com/larryTheCoder/php-grpc-library/blob/main/src/ClientStreamingCall.php) | [BidiStreamingCall](https://github.com/larryTheCoder/php-grpc-library/blob/main/src/BidiStreamingCall.php) |
|:--------------------------------------------------------------------------------------------------------------:|:----------------------------------------------------------------------------------------------------------:|