PHP code example of reatang / grpc-php-abstract

1. Go to this page and download the library: Download reatang/grpc-php-abstract 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/ */

    

reatang / grpc-php-abstract example snippets




use \Path\To\ServerName\SomeServerAbsRpc;

// ... 

// 初始化php-abs-grpc生成的客户端
$client = new SomeServerAbsRpc("127.0.0.1:8080");

// 调用方法
$response = $client->ping(new \Path\To\ServerName\PB\PingRequest(['ping' => 'hello world']));

echo $response->getPong() . PHP_EOL;


shell
> composer