How to use gRPC?

Read the manual, but not many do not understand the logic of how everything works. imagine the work of the gRPC this:
1. someone wrote something on a remote server, say in C#, I have a site running on php and so I can use the API of the remote server using the gRPC. I hope this is true understand.
2. whether on your own server to install the server + client gRPC? or enough customer? in docks it is written like install another server on node.js and the client in php but I am terribly finish these docks since I use openserver + windows and I have the console just no such commands which are described at the docks, and because of this have difficulty.
3. are there any docks for simple people like me, say installing via composer? (extension for php installed).
March 20th 20 at 11:42
1 answer
March 20th 20 at 11:44
1. Need to see what kind of API provides the server. If JSON REST, the gRPC will not work. gRPC is a separate Protocol that needs to support both the client and the server to be able to interact.

2. If you want to communicate with the remote server, you only need the client. If you want to be for someone with a server that provides the gRPC API, you need a server. In PHP you can't do gRPC server, and apparently so offer node.js. Try to raise the server on Linux, instead of openserver. Then there will be the commands described in the dock, and generally the development will be much easier.

3. Simple docks at gRPC not seen.

In addition to the gRPC, you will have to deal with protobuf, as the gRPC is based on it. It also needs to be installed either as a module to PHP, either as a composer dependency. In addition, the remote server must grant the proto file on the basis of which you will do gRPC client. This file must be compiled with protoc (the protobuf compiler) using a special plug-in to it - grpc_php_plugin. The result is a set of PHP scripts that implement gRPC client to access the API of the remote server. Here are the scripts you will use in your scripts to communicate with the server.
Thank you for the reply, are now on paragraph 3 of protobuf is already installed via composer. but grpc_php_plugin I can not find and how to use do not understand. is there any docks on this subject? proto files are available. thanks again. - Jessika commented on March 20th 20 at 11:47
and this plugin is it possible through the composer install? - Jessika commented on March 20th 20 at 11:50
Composer not install. It is a separate independent program that is only needed once for the initial generation grpc client. Next time you need it only when server will make changes to your proto file then you will need to recompile the scripts grpc client. And that is not a fact, since protobuf was created with the expectation of backward compatibility, and if the new features of the new proto file is not needed, and compile again nothing. Another recompile will be required when upgrading to a new version grpc/protobuf module.

Download the compiler with the plugin from the official website. At the end of the page there is a table with links to the results of daily builds. Click on the newest link from the column "Build ID" and download the archive for your system from the section on "gRPC protoc Plugins". The archive will be and the plugin and the compiler itself. - misae commented on March 20th 20 at 11:53

Find more questions by tags PHP