diff options
author | Valery Piashchynski <[email protected]> | 2021-09-16 12:14:09 +0300 |
---|---|---|
committer | Valery Piashchynski <[email protected]> | 2021-09-16 12:14:09 +0300 |
commit | b24b4e066e32aa9be5617f409b3a01a358273cbb (patch) | |
tree | d2d57e577f344afe9a0d0b475ca25c1bfe51421c /tests/plugins/grpc/php_server/worker.php | |
parent | 2aa0b99c588dd9c6a921904966ad435d485e23bb (diff) |
Add test PHP-GRPC server
Signed-off-by: Valery Piashchynski <[email protected]>
Diffstat (limited to 'tests/plugins/grpc/php_server/worker.php')
-rw-r--r-- | tests/plugins/grpc/php_server/worker.php | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/plugins/grpc/php_server/worker.php b/tests/plugins/grpc/php_server/worker.php new file mode 100644 index 00000000..683a2341 --- /dev/null +++ b/tests/plugins/grpc/php_server/worker.php @@ -0,0 +1,26 @@ +<?php +/** + * Sample GRPC PHP server. + */ + +use Service\EchoInterface; +use Spiral\Goridge\StreamRelay; +use Spiral\GRPC\Server; +use Spiral\RoadRunner\Worker; + +require __DIR__ . '/vendor/autoload.php'; + +$server = new Server(null, [ + 'debug' => false, // optional (default: false) +]); + +$server->registerService(EchoInterface::class, new EchoService()); + +$worker = \method_exists(Worker::class, 'create') + // RoadRunner >= 2.x + ? Worker::create() + // RoadRunner 1.x + : new Worker(new StreamRelay(STDIN, STDOUT)) +; + +$server->serve($worker); |