Download the PHP package goletter/hyperf-docs without Composer
On this page you can find all versions of the php package goletter/hyperf-docs. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package hyperf-docs
Docs
Hyperf 文档平台扩展包,支持多平台:
- Google:OAuth、Sheets、Drive(gid 定位、追加、按内容查找、受保护列 / 勾选框)
- 腾讯文档:OAuth、在线表格、文件夹、分享权限
安装
本地 path 开发(推荐,可自动加载 ConfigProvider)
Hyperf 通过 Composer::getMergedExtra('hyperf')['config'] 收集各已安装包的 extra.hyperf.config。
若只在根项目 autoload.psr-4 映射源码目录,包不会进入 vendor/composer/installed.json,ConfigProvider 不会自动加载。
请用 path 仓库以 Composer 包方式引入:
然后执行:
成功后会出现 vendor/goletter/hyperf-docs(一般为软链),ConfigProvider 中的 dependencies / annotations.scan.paths / publish 会自动合并进框架,无需再在 config/autoload/dependencies.php 手动绑定。
不要同时保留根项目
autoload.psr-4里的Goletter\\Docs\\映射,以免与 path 包重复定义。
配置
发布配置:
环境变量:
Google:
access_token短期有效,请保存refresh_token并在过期后刷新。
腾讯文档需先在 开放合作平台 创建应用并完成审核;OpenAPI 除Access-Token外必须带Open-Id(换 token 回包中的user_id)。表格接口通常需要scope.sheet/scope.sheet.readonly。
使用
两个平台都已定义,通过工厂模式创建,可同时配置、按需选用。
扩展自定义平台:
统一 createSpreadsheet 返回值:
Google OAuth / Sheets
Range / gid
| 写法 | 说明 |
|---|---|
Sheet1!A1:Z100 |
按工作表标题 |
'含空格标题'!A1 |
特殊字符标题自动加引号 |
gid:123456 |
整表(读为 A:Z) |
gid:123456!A1:Z100 |
指定 gid + A1 |
gid:123456!F1 |
只写某一列 |
读取
按内容查找指定行
写入(受保护列 / 勾选框)
编辑指定行
删除指定行
追加到表格末尾
含 null 时会先算下一空行,再只写有值的列(避开受保护列)。勾选列请传布尔 true / false,不要用 ''。
其它
也可直接注入底层 GoogleAuth / GoogleSheets(不经过工厂),参数为原始 accessToken 字符串。
腾讯文档 OAuth / 表格
权限变更或接口报 Request Scope Invalid 时:在开放平台开通表格相关权限 → 用户重新授权换新 token。
能力对照
| 能力 | 腾讯文档 | |
|---|---|---|
| OAuth 授权 / 刷新 | ✅ | ✅ |
| 创建表格 | ✅ Spreadsheet | ✅ type=sheet |
| 读单元格 | ✅ Values(过滤空行) | ✅ spreadsheet v3 |
| 写单元格 | ✅ Values(null 跳过保护列) | ✅ sheetbook v2 |
| 编辑指定行 | ✅ updateRow(行号 / 按列查找) |
✅ updateRow |
| 删除指定行 | ✅ deleteRow(行号 / 按列查找) |
✅ deleteRow |
| 追加行 | ✅ appendCells |
✅ appendCells |
| 按列内容查找 | ✅ findRows |
✅ findRows |
| gid / sheetId 定位 | ✅ URL #gid= |
✅ 标题或 sheetId |
| 勾选框 | ✅ true / false |
— |
| 添加工作表 | ✅ | ✅ spreadsheet v3 batchUpdate |
| 移动到日期目录 | ✅ Drive | ✅ folders + move |
| 公开只读分享 | ✅ anyone reader | ✅ publicRead |
测试命令
包内自带:
业务侧也可自建命令,用 DocsManager + gid / appendCells / findRows 做联调。
All versions of hyperf-docs with dependencies
google/apiclient Version ^2.19
guzzlehttp/guzzle Version ^7.0
hyperf/command Version ~3.1.0
hyperf/contract Version ~3.1.0
hyperf/di Version ~3.1.0