1. Go to this page and download the library: Download playtini/grpc-server-bundle 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/ */
playtini / grpc-server-bundle example snippets
namespace App\Calculator;
use Playtini\MainServiceName\Calculator\CalculatorInterface;
use Playtini\MainServiceName\Calculator\Result;
use Playtini\MainServiceName\Calculator\Sum;
use Spiral\GRPC;
class CalculatorService implements CalculatorInterface
{
public function Sum(GRPC\ContextInterface $ctx, Sum $in): Result
{
return new Result([
'result' => $in->getA() + $in->getB(),
]);
}
}