找不到类别'Grpc \ BaseStub'

时间:2019-10-08 14:02:11

标签: php grpc

尝试运行由protoc从一堆*.proto文件中生成的PHP客户端代码。 PHP代码在具有php7.3的docker容器上运行,并且安装并启用了GRPC扩展:pecl/grpc is already installed and is the same as the released version 1.23.1

代码运行时,出现以下错误:Class 'Grpc\BaseStub' not found

该错误由以下行触发:class ProductServiceClient extends \Grpc\BaseStub {。这是自动生成的代码中的一行,因此无法修改。

[编辑] 运行composer require grpc/grpc解决了此问题;但是,我现在有Class 'Google\Protobuf\Internal\Message' not found

[编辑] 运行composer require google/protobuf解决了第二个问题。

1 个答案:

答案 0 :(得分:1)

尝试添加grpc lib:

composer require grpc/grpc