beromir/neos-ray

使用 Ray 应用调试您的 Neos 网站。

安装: 133

依赖项: 0

建议者: 0

安全: 0

星标: 2

关注者: 2

分支: 0

开放问题: 0

类型:neos-package

v1.4.0 2022-04-21 10:55 UTC

This package is not auto-updated.

Last update: 2024-09-19 21:59:49 UTC


README

使用 Ray 应用调试您的 Neos 网站。
Ray 是 Spatie 的一款调试应用。您可以在 https://myray.app/ 上找到更多关于 Ray 的信息。
官方 Ray 文档:https://spatie.be/docs/ray/v1/introduction

安装

在您的网站包中运行以下命令

composer require --no-update beromir/neos-ray

然后在您的项目根目录中运行 composer update

要求

您需要安装 Ray 应用并拥有有效的许可证。您可以从这里下载应用:https://spatie.be/docs/ray/v1/the-ray-desktop-app/download-the-free-demo

配置

在您的 Neos 网站根目录中创建配置文件 ray.php
配置选项:https://spatie.be/docs/ray/v1/configuration/framework-agnostic-php
使用 Docker 时的配置选项:https://spatie.be/docs/ray/v1/environment-specific-configuration/docker

用法

您可以从 https://spatie.be/docs/ray/v1/usage/framework-agnostic-php-project 使用所有 Ray 函数。
参考列表(仅针对 PHP 特定函数):https://spatie.be/docs/ray/v1/usage/reference

要使用这些函数,您必须在 Fusion 中将它们作为键值对添加。
如果函数不需要任何参数,您可以使用 nullfalse 或空字符串作为值。
要传递参数,请将它们作为值添加。

valueToDebug = 'Show this text in the Ray app.'
valueToDebug.@process.debug = Beromir.Ray:Debug {
   // Show a label in the Ray app
   label = 'Text'
   // Colorize the output
   red = ''
   // Show the output as large text
   large = ''
}
valueToDebug = 'Show this text in the Ray app.'
valueToDebug.@process.debug = Beromir.Ray:Debug {
   // Show a label in the Ray app
   label = 'Text'
   // Only send a payload once when in a loop
   once = ${node}
}

调试 Fusion 表达式

valueToDebug = 'Show this text in the Ray app.'
valueToDebug.@process.debug = Beromir.Ray:Debug

其他方法

// Debug the current node
debug = Beromir.Ray:Debug {
   value = ${node}
}

renderer = afx`
   {props.debug}
`
renderer = afx`
   <Beromir.Ray:Debug value={node}/>
`

调试多个值

debug = Beromir.Ray:Debug {
   // Pass the values as an array
   value = ${[node, site]}
}

renderer = afx`
   {props.debug}
`

使用 Debug Actions 调试 NodeTypes

// Display the NodeType name of the node
debug = Beromir.Ray:Debug {
   value = ${node}
   debugAction = 'nodeTypeName'
}

renderer = afx`
   {props.debug}
`
// Display the properties of the current node and the site node
debug = Beromir.Ray:Debug {
   value = ${[node, site]}
   debugAction = 'properties'
}

renderer = afx`
   {props.debug}
`

您可以用于 NodeTypes 的以下 Debug Actions

Eel Helper

您还可以使用 Ray Eel Helper 调试您的网站。

{Beromir.Ray.debug(node)}

{Beromir.Ray.debug([node, site])}

第二个参数可以用于为 NodeTypes 设置调试操作。

{Beromir.Ray.debug(node, 'properties')}