1. Go to this page and download the library: Download beauty-framework/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/ */
beauty-framework / grpc example snippets
namespace App\Controllers\GRPC;
use GRPC\Greeter\GreeterInterface;
use GRPC\Greeter\HelloRequest;
use GRPC\Greeter\HelloReply;
use Beauty\GRPC\GrpcService;
use Spiral\RoadRunner\GRPC\ContextInterface;
#[GrpcService(GreeterInterface::class)]
class Greeter implements GreeterInterface
{
public function SayHello(ContextInterface $ctx, HelloRequest $in): HelloReply
{
return new HelloReply([
'message' => 'Hello ' . $in->getName(),
]);
}
}