Giter VIP home page Giter VIP logo

grpc-go-php's Introduction

Install

Prepare PHP client

Install dependencies

cd client/ && composer install

Generate php protobuf definition

From root directory

GRPC_PHP_PLUGIN_PATH=$(PATH_OF_GRPC_PLUGIN)/bins/opt/grpc_php_plugin
protoc --proto_path=.  \
   --php_out=client/lib \
   --grpc_out=client/lib \
   --plugin=protoc-gen-grpc=$GRPC_PHP_PLUGIN_PATH \
   ./client/service.proto

Create GO server

Protobuf definition are already generated in source code and will be complied during runtime

Run

Run go server that accept grpc connection

Note that this server needs to be ran before client

cd server/ && go run main.go

Run php client from root directory

Note that this client include a timer to calculate time spent on request

php client/greeter_client.php $number_of_outcoming_request

Example of output

$ php client/greeter_client.php 1
Requesting for 1 call(s)
[...]
This process used 9 ms for its computations
It spent 3 ms in system calls

$ php client/greeter_client.php 10
Requesting for 10 call(s)
[...]
This process used 11 ms for its computations
It spent 4 ms in system calls

grpc-go-php's People

Contributors

siwane avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.