Download the PHP package xhtkyy/hyperf-tools without Composer
On this page you can find all versions of the php package xhtkyy/hyperf-tools. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package hyperf-tools
xhtkyy/hyperf-tools
快速开始
composer require xhtkyy/hyperf-tools
发布配置
php bin/hyperf.php vendor:publish xhtkyy/hyperf-tools
更新
20230602
-
增加服务支持Streaming模式 可参照健康检查watch方法的使用
- Grpc Health Watch 增加 Streaming 支持
20230536
-
移除overwrite 增加class_map覆盖代码,只需要配置 annotations 增加如下
- 增加支持错误响应携带状态码 需要注意 这里将错误返回的字符串变成对象 可以加(string)$reply 转字符串
基础
容器
-
通过注入获取(推荐)
- 通过实例化(不推荐) Xhtkyy\HyperfTools\App\Container
- 通过助手函数 di(class)
异常
异常是需要规范的,这里举例了 NotFoundException(找不到资源)、InvalidArgumentException(无效参数异常) 其他自定义异常 继承 Xhtkyy\HyperfTools\App\Exception\AppException::class 即可轻松捕抓
CURD
将基础的CURD封装 继承 Xhtkyy\HyperfTools\CURDRepo\CURDRepo 即可,如
服务注册/发现
1、发布配置
2、服务注册
自动发现配置中server_name配置的服务名称,在路由中对应服务名称,如以下 "grpc"
3、服务发现
使用继承 \Xhtkyy\HyperfTools\GrpcClient\BaseGrpcClient 即可完成服务自动发现 可在配置中配置发现算法 默认轮询
链路追踪
使用 Xhtkyy\HyperfTools\Grpc\Middleware\GrpcTraceMiddleware 作用于grpc服务路由即可完成 grpc链路追踪
All versions of hyperf-tools with dependencies
amphp/hpack Version ^3.1
dtm/dtm-client Version ^0.3.2
hyperf/command Version ^3.0
hyperf/db-connection Version ~3.0.0
hyperf/di Version 3.0.*
hyperf/event Version ~3.0.0
hyperf/framework Version 3.0.*
hyperf/grpc-client Version ~3.0.0
hyperf/grpc-server Version ~3.0.0
hyperf/http-server Version ~3.0.0
hyperf/load-balancer Version ~3.0.0
hyperf/rpc-server Version ~3.0.0
hyperf/service-governance Version ~3.0.0
hyperf/service-governance-consul Version ~3.0.0
hyperf/service-governance-nacos Version ~3.0.0
hyperf/tracer Version ~3.0.0
jonahgeorge/jaeger-client-php Version ^1.4