Grpc go-server php-client

Overview

前置工作

  • 安装 protobuf

  • 安装PHP相关扩展(grpcprotobuf

  • 生成grpc_php_plugin

    $ git clone -b RELEASE_TAG_HERE https://github.com/grpc/grpc
    $ cd grpc
    $ git submodule update --init
    $ mkdir -p cmake/build
    $ cd cmake/build
    $ cmake ../..
    $ make protoc grpc_php_plugin
    $ mv ./grpc_php_plugin /opt/homebrew/bin/
  • 生成相应语言的文件命令

    GO
     protoc -I. --go_out=plugins=grpc:./pb pb/user.proto
    PHP
    cd php-server
    
    protoc --proto_path=../pb --php_out=. --grpc_out=. --plugin=protoc-gen-grpc=/opt/homebrew/bin/grpc_php_plugin ../pb/user.proto

启动GRPC服务

➜  grpc-demo go run server.go 
2022/01/24 09:55:49 receive user index request: page 1 page_size 12
2022/01/24 09:55:49 receive user view request: uid 1
2022/01/24 09:55:49 receive user post request: name 12312 password 324523 age 12

启动GRPC客户端

GO GRPC客户端
➜  grpc-demo go run client/client.go 
2022/01/24 09:56:46 user index success: success
u1 11
u2 12
2022/01/24 09:56:46 user view success: success
james 28
2022/01/24 09:56:46 user post success: success
2022/01/24 09:56:46 user delete success: success
PHP GRPC客户端
➜  php-server php  client.php
success
success
success
You might also like...
The most widely used PHP client for RabbitMQ

php-amqplib This library is a pure PHP implementation of the AMQP 0-9-1 protocol. It's been tested against RabbitMQ. The library was used for the PHP

kafka php client
kafka php client

Kafka-php 中文文档 Kafka-php is a pure PHP kafka client that currently supports greater than 0.8.x version of Kafka, this project v0.2.x and v0.1.x are in

Artax is an asynchronous HTTP client for PHP based on Amp

Artax is an asynchronous HTTP client for PHP based on Amp. Its API simplifies standards-compliant HTTP resource traversal and RESTful web service consumption without obscuring the underlying protocol. The library manually implements HTTP over TCP sockets; as such it has no dependency on ext/curl.

Idiomatic PHP client for Google Compute.

Google Compute for PHP Idiomatic PHP client for Google Compute. API Documentation NOTE: This repository is part of Google Cloud PHP. Any support reque

An unofficial EdgeDB PHP client.

Unofficial EdgeDB HTTP PHP client Requirements PHP = 8.0 (with fileinfo and mbstring) An EdgeDB server instance (tested with 1.0+9ecadfc) Quickstart

A standalone Amazon S3 (REST) client for PHP 5/CURL

Amazon S3 PHP Class Usage OO method (e,g; $s3-getObject(...)): $s3 = new S3($awsAccessKey, $awsSecretKey); Statically (e,g; S3::getObject(...)): S3::

A PHP implementation of RabbitMQ Client for webman plugin.
A PHP implementation of RabbitMQ Client for webman plugin.

workbunny/webman-rabbitmq 🐇 A PHP implementation of RabbitMQ Client for webman plugin. 🐇 A PHP implementation of RabbitMQ Client for webman plugin 常

PHP DataDog StatsD Client

PHP DataDog StatsD Client This is an extremely simple PHP DogStatsD client. Requires PHP = 5.6.0. See CHANGELOG.md for changes. For a Laravel-specifi

A PHP MySQL database client class to simplify database access

This lightweight database class is written with PHP and uses the MySQLi extension, it uses prepared statements to properly secure your queries, no need to worry about SQL injection attacks.

Owner
凡事预则立,不预则废。
凯
For server-to-server comms from PHP to CloudKit.

CloudKit-PHP Today I found this fantastic gist by Mauricevb that demonstrates how to communicate with CloudKit from PHP. I already had a previous proj

Tim Oliver 1 Oct 14, 2021
Calibre OPDS (and HTML) PHP Server : web-based light alternative to Calibre content server / Calibre2OPDS to serve ebooks (epub, mobi, pdf, ...)

COPS COPS stands for Calibre OPDS (and HTML) Php Server. See : COPS's home for more details. Don't forget to check the Wiki. Why ? In my opinion Calib

Sébastien Lucas 1.3k Jan 1, 2023
This project processes a small database with php all on a web server. This project uses XAMPP to run the web server and the database.

PHP-introduction This project processes a small database with php all on a web server. This project uses XAMPP to run the web server and the database.

Tyler Jacques 1 Jan 6, 2022
A plugin that allows you to hear the sound "Welcome to the server!" when you join the server by NhanAZ for PocketMine-MP

General A plugin that allows you to hear the sound "Welcome to the server!" when you join the server by NhanAZ for PocketMine-MP Contacts You can cont

NhanAZ's PocketMine-MP Plugins 10 Sep 27, 2022
EXT:server-timing adds Server-Timing Header with usefull information

EXT:server_timing - see your performance installation composer require kanti/server-timing at the moment there is nothing to configure Server timings

Matthias Vogel 4 Oct 26, 2022
A Simplistic Plugin to Implement Server Claims to your Minecraft: Bedrock Server.

Claims This plugin allows administrators to create, edit, list, and teleport to land claims on a PocketMine server. These claims have a variety of cus

Santana 5 Jun 10, 2023
Complete Pipedrive API client for PHP

Complete Pipedrive API client for PHP Contribute by referral code / link This won't take much time. You could use my referral code or link to get up t

Israel Ortuño 155 Dec 7, 2022
A GETTR.com client library written in PHP with Laravel support.

Gettr API Clinet PHP A GETTR.com client library written in PHP with Laravel support. This library uses unofficial publicly accessible API endpoints of

null 10 Dec 13, 2022
SendCloud client for PHP

SendCloud client for PHP Installation composer require guangda/sendcloud Example $mailData = [ 'to'=>'[email protected]', 'subject'=>'test',

Guangda 3 Aug 27, 2021
Bearer client for the PHP programming language

Bearer PHP Client This is the official PHP client for interacting with Bearer.sh. Installation Install the package by running: composer require bearer

Bearer 9 Oct 31, 2022