genxbe / kirby3-ray
一个辅助工具,使 ray 能够在所有可扩展方法上运行。
2.0.2
2024-02-27 18:41 UTC
Requires
- php: ^8.0
- getkirby/composer-installer: ^1.1
- spatie/macroable: ^2.0
- spatie/ray: ^1.3
This package is auto-updated.
Last update: 2024-09-27 19:57:59 UTC
README
一个辅助工具,使 ray 能够在所有可扩展方法上运行。
Ray 是来自 Spatie 朋友们的优秀 dump 调试器。您可以在 https://myray.app/ 上找到有关 Ray 的更多信息。
注意:Kirby > 3.7
此插件覆盖了 Kirby 核心中的 dump
辅助工具。请将以下内容放在您的 index.php
文件的顶部。
define('KIRBY_HELPER_DUMP', false);
选项
默认情况下,ray 辅助工具不会启用,您可以通过将 debug
设置为 true
或在配置文件中添加 enabled
选项来启用它。
# site/config/config.php return [ 'debug' => true, // OR // 'genxbe.ray.enabled' => true, ];
用法
在您想要在 ray 中解析的页面、字段或其他对象之后添加 ->ray()
。此辅助工具不会中断您的流程,因此如果您添加了辅助工具,您正在执行的操作仍然可以正常工作。如果想要启用颜色过滤,可以将颜色作为参数传递。
示例
<?php // Parse page in ray $myField = $page->ray()->myField(); // Parse page in ray with the blue color filter active $myTitle = $page->ray('blue')->myTitle(); // Parse the page and the field in ray $projects = $page->ray()->projects()->ray(); ?> <?= $site->seoOgImage()->ray() ?> <?= $site->footerLinks()->toStructure()->ray() ?> <?= $site->footerLinks()->ray('red')->toStructure()->ray('blue') ?>
安装
下载
下载并将此存储库复制到 /site/plugins/kirby3-ray
。
Git 子模块
git submodule add https://github.com/genxbe/kirby3-ray.git site/plugins/kirby3-ray
Composer
composer require genxbe/kirby3-ray
许可证
MIT