1. Go to this page and download the library: Download roadrunner/grpc library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
roadrunner / grpc example snippets
use Service\EchoInterface;
use Service\Message;
use Spiral\RoadRunner\GRPC\ContextInterface;
final class EchoService implements EchoInterface
{
public function Ping(ContextInterface $ctx, Message $in): Message
{
return (new Message())->setMsg(\date('Y-m-d H:i:s') . ': PONG');
}
}
use Service\EchoInterface;
use Spiral\RoadRunner\GRPC\Invoker;
use Spiral\RoadRunner\GRPC\Server;
use Spiral\RoadRunner\Worker;
rface::class, new EchoService());
$server->serve(Worker::create());