PHP code example of hetao29 / php-grpc-server-thrift

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

    

hetao29 / php-grpc-server-thrift example snippets



define("ROOT", dirname(__FILE__)."/../");
define("ROOT_LIBS", ROOT."/libs");
define("ROOT_SERVICE", ROOT."/service");
define("ROOT_PROTO_GENERATED", ROOT."/thrift_out/");



namespace Test\HelloThrift;

class HelloServiceHandler implements HelloServiceIf {

    public function sayHello($username)
    {
        return "Hello ".$username.", how are u?";
    }
}


bash
composer 
bash
php www/client.php