genxbe/kirby3-ray

Helper tool that enables ray on all the extendable methods.

Installs: 4 920

Dependents: 1

Suggesters: 0

Security: 0

Stars: 21

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-10-27 20:11:46 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/.

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