jeyroik/extas-jsonrpc

此包的最新版本(4.1.0)没有可用的许可信息。

Extas jsonrpc 包


README

tests codecov.io PHPStan Enabled Extas Installer v3 Latest Stable Version Total Downloads Dependents

描述

Extas 兼容的 JSON RPC 服务器。

安装操作

安装 jsonrpc 插件和默认操作

# vendor/bin/extas i

开箱即用使用

启动服务器

# php -S 0.0.0.0:8080 -t src/public

发送请求

# curl -X POST localhost:8080/api/jsonrpc -d '{"id": "request id", "method":"operation.index"}'

规范生成

此包允许在 InstallSection- 插件上生成规范,扩展自 extas\components\plugins\intsall\InstallSection

此包允许在 InitSection- 插件上生成规范,扩展自 extas\components\plugins\init\InitSection

* - 您可以重置此前缀(见下文)。

存在用于规范生成的 extas 命令。命令已准备好扩展,因此您可以使用 extas-commands-options 表记添加自己的选项。请参阅当前包的 extas.json 以获取示例。

安装命令

  • # vendor/bin/extas i
  • # vendor/bin/extas list - 命令 jsonrpc 应列出。

生成规范

# vendor/bin/extas jsonrpc --export-path generated.extas.json

这将生成开箱即用的 extas 兼容配置。

因此,您可以通过以下方式安装规范:

# vendor/bin/extas i

--export-path

定义存储生成的规范的路径。

  • 默认值: CWD/specs.extas.json
  • 您可以传递相对路径和绝对路径。

CWD - 当前工作目录。

--prefix-jsonrpc-install

允许设置由安装部分爬虫搜索插件的命名前缀。

  • 默认值: Install

--path-jsonrpc-install

允许设置由安装部分爬虫搜索插件的路径。

  • 默认值: 当前工作目录。

--prefix-jsonrpc-doc-comment

允许设置由文档注释爬虫搜索类的命名前缀。

  • 默认值: Install

--path-jsonrpc-doc-comment

允许设置由文档注释爬虫搜索类的路径。

  • 默认值: 当前工作目录。

-f --filter

允许过滤操作名称。

  • 默认值:
  • 示例: # vendor/bin/extas jsonrpc -f workflow 将仅生成具有 workflow 名称的操作的规范。

-e --only-edge

有时您想使实体名称更短,并仅使用插件名称的最后一个单词。

您可以使用选项 -e 来完成此操作。

例如,我们有一个插件名称 workflow schema

  • 默认值: 0 - 生成实体名称 workflow.schema
  • 使用边缘: # vendor/bin/extas jsonrpc -e 1 将生成实体名称 schema

规范示例

您可以在这里找到它们

  • resources/create.spec.json
  • resources/index.spec.json
  • resources/update.spec.json
  • resources/delete.spec.json

注入到 json-rpc 流程中

当前包提供以下阶段,以允许您注入到 json-rpc 流程中

  • before.run.jsonrpc - 在每次 json-rpc 处理之前。
  • before.run.jsonrpc.<method.name>
  • after.run.jsonrpc.<method.name>
  • after.run.jsonrpc - 在每次 json-rpc 处理之后。

生成器

包使用 extas-generators 包来获取生成器。

如果您想使用其中一个,请开启生成器。

您可以在 resources/generators.json 中找到开箱即用的默认生成器配置。只需将它们复制粘贴到您的 extas.json 中。

爬虫

包使用 extas-crawlers 包来获取爬虫。

如果您想使用其中一个,请开启爬虫。

您可以在 resources/crawlers.json 中找到开箱即用的默认爬虫配置。只需将它们复制粘贴到您的 extas.json 中。