treast/kirby-debugbar

PHP Debug Bar for KirbyCMS

Installs: 129

Dependents: 0

Suggesters: 0

Security: 0

Stars: 14

Watchers: 2

Forks: 0

Open Issues: 0

Language:JavaScript

Type:kirby-plugin

1.3.2 2023-12-02 01:38 UTC

This package is auto-updated.

Last update: 2024-05-01 00:07:56 UTC


README

Demonstration

✨ Features

  • Integration of PHP Debug Bar
  • Easy log messages
  • Preview configuration, hooks called, files, page variables, requests & exceptions
  • More soon 👀 ...

🔌 Installation

⚠️ This plugin uses the Symfony VarDumper package, which conflicts with the KirbyCMS dump function. To use this plugin, you must imperatively change the index.php file at the root by this content:

<?php

define('KIRBY_HELPER_DUMP', false);

require __DIR__ . '/kirby/bootstrap.php';

echo (new Kirby)->render();

Composer (highly recommended)

composer require treast/kirby-debugbar

Git submodule

git submodule add https://github.com/Treast/kirby-debugbar.git site/plugins/debugbar

Manual

Download this zip and unzip it in site/plugins/debugbar.

💻 Usage

Add this snippet at the bottom of your footer & enjoy !

<?= snippet('debugbar') ?>

How to log ?

$site->logger()->debug('This is a debug');
$site->logger()->emergency('This is an emergency');
$site->logger()->error('This is an error');
$site->logger()->critical('This is a critical');
$site->logger()->info('This is an info');
$site->logger()->warning('This is a warning');
$site->logger()->alert('This is an alert');
$site->logger()->notice('This is a notice');
$site->logger()->log('debug', 'This is also a debug');
// Or you can chain with the ->log() function
$site->log()->title()->log();
$page->children()->log()->first()->log();

Options

Explanations

Option name Default Type Description
treast.debugbar.force false boolean If enabled, will display the debug bar even with debug === false
treast.debugbar.tabs.logs true boolean Show logs tab
treast.debugbar.tabs.config true boolean Show config tab
treast.debugbar.tabs.events true boolean Show events tab
treast.debugbar.tabs.files true boolean Show files tab
treast.debugbar.tabs.variables true boolean Show variables tab
treast.debugbar.tabs.request true boolean Show request tab
treast.debugbar.tabs.exception true boolean Show exceptions tab

config.php

<?php

return [
  'treast.debugbar' => [
    'force' => false,
    'tabs' => [
      'logs' => true,
      'config' => true,
      'events' => true,
      'files' => true,
      'variables' => true,
      'request' => true,
      'exceptions' => true
    ]
  ]
];

To Do

  • Only activate plugin when debug === true
  • Refactoring 😮‍💨

💡 I would like XXX but it's not yet available?

Go to the issues and submit your idea. If it's relevant, I might add it 🫶.

❤️Special Thanks

⚠️Warning

Please note that this plugin is provided as is, without any express or implied warranty of operation. By using this plugin, you agree to do so at your own risk. I am not responsible for any direct or indirect damage resulting from the use of this plugin, including loss of data, operating errors, service interruptions, or any other consequence related to the use of this plugin.