Download the PHP package imiphp/imi-grpc without Composer

On this page you can find all versions of the php package imiphp/imi-grpc. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package imi-grpc

imi-grpc

Latest Version Php Version Swoole Version IMI License

介绍

在 imi 框架中集成 gRPC 服务开发、客户端调用及连接池。

通讯协议为二进制的 Protobuf。

本仓库仅用于浏览,不接受 issue 和 Pull Requests,请前往:https://github.com/imiphp/imi

Composer

本项目可以使用composer安装,遵循psr-4自动加载规则,在你的 composer.json 中加入下面的内容:

然后执行 composer update 安装。

使用说明

可以参考 example 目录示例,包括完整的服务端和客户端调用。

服务和消息格式定义

gRPC 和 Protobuf 是黄金搭档,Protobuf 是用来做通讯消息格式的序列化和反序列化的工作。

gRPC 通讯有请求(Request)消息和响应(Response)消息,从请求消息中获取请求参数,通过响应消息返回给客户端。

定义参考:example/grpc/grpc.proto

定义好后,通过命令生成 PHP 文件:protoc --php_out=./ grpc.proto

protoc 下载和安装:https://github.com/protocolbuffers/protobuf/releases

服务端

在项目 config/config.php 中配置:

如果你用主服务器:

如果你用子服务器:

控制器

写法与 Http Api 几乎一致。

标准 gRPC Url 格式为:http://host:port/{package}.{service}/{method}

客户端

连接池配置

客户端调用

代码调用:

注解调用:

@GrpcService 注解的 serviceName 属性格式为 {package}.{service}interface 属性是生成出来的服务接口类名

↓↓↓注意↓↓↓:

使用 @GrpcService 注解注入时,如果调用的 grpc 接口方法名是:getNamesendrecvcallgetClient,请使用 call 方法来调用,因为这和内置方法名相冲突了。

免费技术支持

QQ群:17916227 点击加群,如有问题会有人解答和修复。

运行环境

版权信息

imi-grpc 遵循 MIT 开源协议发布,并提供免费使用。

捐赠

开源不求盈利,多少都是心意,生活不易,随缘随缘……


All versions of imi-grpc with dependencies

PHP Build Version
Package Version
Requires imiphp/imi-rpc Version ~2.1.0
yurunsoft/yurun-http Version ~4.4|~5.0
google/protobuf Version ^3.10.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package imiphp/imi-grpc contains the following files

Loading the files please wait ....