我们可以用PHP而不是NodeJS创建GRPC服务器吗?

I'm new to GRPC I read the quickstart guide and PHP basics. But I see lot all are using NodeJS to run the server side for grpc. But what I wanted to achieve is use PHP on both ends of grpc and create Server + Client in PHP only.

So it's like Client will send the informtation to server and Server will process the information realtime.

I have checked the test case files ServerTest.php code is below

class ServerTest extends PHPUnit_Framework_TestCase
{
    public function setUp()
    {
    }

    public function tearDown()
    {
    }

    /**
     * @expectedException InvalidArgumentException
     */
    public function testInvalidConstructor()
    {
        $server = new Grpc\Server('invalid_host');
    }

    /**
     * @expectedException InvalidArgumentException
     */
    public function testInvalidAddHttp2Port()
    {
        $this->server = new Grpc\Server([]);
        $this->port = $this->server->addHttp2Port(['0.0.0.0:0']);
    }

    /**
     * @expectedException InvalidArgumentException
     */
    public function testInvalidAddSecureHttp2Port()
    {
        $this->server = new Grpc\Server([]);
        $this->port = $this->server->addSecureHttp2Port(['0.0.0.0:0']);
    }
}

I'm not sure if this is possible any help would be highly appriciated:

thanks

I'm not sure if this is possible

Read description of gRPC - gRPC is a language neutral and platform neutral

So yes, you can. gRPC PHP tutorial

You can use gRPC PHP clients to connect to servers written in Node, Java, Python, or a number of other supported languages, but currently gRPC does not support writing PHP servers. The gRPC PHP tutorial describes how to set up a client.

There have been some discussions about implementing gRPC servers in PHP, e.g., the gRPC to FastCGI bridge mentioned on the grpc-io mailing list, but currently this is not supported in gRPC.

roadrunner may help. It's a golang frontend server with php worker pool.