genxbe/kirby3-ray

Helper tool that enables ray on all the extendable methods.

Installs: 3 421

Dependents: 1

Suggesters: 0

Security: 0

Stars: 22

Watchers: 2

Forks: 1

Open Issues: 0

Type:kirby-plugin

2.0.2 2024-02-27 18:41 UTC

This package is auto-updated.

Last update: 2024-04-27 19:10:43 UTC


README

Helper tool that enables ray on all extendable methods.

Ray is the fantastic dump debugger from our friends at Spatie. You can find more information about Ray on https://myray.app/.

68747470733a2f2f7374617469632e676e782e636c6f75642f67656e782f6b697262792f6b69726279332d7261792d6c6f6f702e676966

Important note for Kirby > 3.7

This plugin overrides the dump helper from Kirby core. Please put the following at the top of your index.php.

define('KIRBY_HELPER_DUMP', false);

Options

By default the ray helper won’t be enabled, you can enable it by setting debug to true or by adding the enabled option in the config file.

# site/config/config.php
return [
  'debug' => true,

  // OR //

  'genxbe.ray.enabled' => true,
];

Usage

Add ->ray() after the page, field, or other object you want to parse in ray. This helper doesn’t interrupt your flow so whatever you are doing will still work if you add the helper. Pass a color as parameter if you want to enable color filtering in ray.

Examples

<?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') ?>

Installation

Download

Download and copy this repository to /site/plugins/kirby3-ray.

Git submodule

git submodule add https://github.com/genxbe/kirby3-ray.git site/plugins/kirby3-ray

Composer

composer require genxbe/kirby3-ray

License

MIT

Credits