Kirby Hooks Debugger

Kirby Hooks Debugger

There are two main problems with hook errors in the panel.

  1. The panel hangs.
  2. No useful information about the error is displayed.

This plugin presents a useful error message.

In the future I hope there will be a built in solution, but until then this plugin might be useful.

1. Install

Kirby CLI

Run this command:

kirby plugin:install jenstornell/kirby-hooks-debugger


Add the folder kirby-hooks-debugger into /site/plugins/.

2. Usage

1. Blueprint

It’s recommended to add this field before any other field.

    type: hooksdebugger

2. Must be loaded first

Kirby Hooks Debugger needs to load before any other plugin that uses hooks in order to work. There are at least two ways to do that:

Alternative 1 - Rename the plugin

Rename the folder kirby-hooks-debugger to aaa and the file kirby-hooks-debugger.php to aaa.php.

Alternative 2 - Load the Kirby Hooks Debugger plugin from your plugin

If you are building a plugin you can add this line to force load the Kirby Hooks Debugger plugin.


3. Debug needs to be true

You need to set this in config.php:

c::set('debug', true);


Add them to config.php.

Logfile path

Where the log should be stored.

c::get( 'plugin.hooks.debugger.logfile', kirby()->roots()->index() . DS . 'hooks-debugger.txt' );

Error types

Add an array with error numbers or constants.

Default is to only show fatal run-time errors.

c::get('plugin.hooks.debugger.error.types', array(1));


Hooks to debug. Default is every built in hook.

c::get('plugin.hooks.debugger.hooks', array(



Initial release


Kirby 2.3.2




I really like this a lot!! I also agree that we need a better built-in solution, but I’m glad you got us covered in the meantime :slight_smile:

1 Like

Thanks! :smiley:

The key functions in my solution is:


With these functions the latest error can be fetched and do something useful with the error message. Maybe you already know that. :slight_smile:

I have also thought about how to solve the problem with that the panel hangs when there are errors. First I figured out that Ajax would be a solution because the request would then be an isolated event and can be taken care of.

When thinking about it some more what is really needed is an extra http request, like calling a route and see if it’s a valid json or not. As far as I know that would be the only thing that can make the panel continue to load even if there are errors.

Question: If I or someone solves a problem that in the long run should be solved in the core, will it delay the development of that feature because a solution already exists as a plugin? Or is it the other way around, that because there are one or many plugins to solve something it’s set to a high priority to solve in the core? Or does a plugin don’t have any affect at all on the core directions?

Everything together. :slight_smile:
We decide on the features to implement based on the number of users who need the feature. If there’s a plugin that’s used a lot, we of course consider that and prioritize the feature.

1 Like