malekim/halt

Plugin that extend DebugKit with HaltPanel to help debugging CakePHP3 applications

Installs: 2

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 0

Open Issues: 0

Type:cakephp-plugin

v1.0.0 2019-06-26 17:21 UTC

This package is not auto-updated.

Last update: 2024-04-26 17:11:38 UTC


README

Installation

You can install this plugin into your CakePHP application using composer.

The recommended way to install composer packages is:

composer require malekim/halt

It is also required to have Debug Kit installed.

Then register the plugin in src/Application.php:

$this->addPlugin(\Halt\Plugin::class);
Configure::write('DebugKit.panels', ['Halt.Halt']);

Recommended way is to add those lines between debug condition and then DebugKit load should be similar to:

if (Configure::read('debug')) {
    $this->addPlugin(\Halt\Plugin::class);
    Configure::write('DebugKit.panels', ['Halt.Halt']);
    $this->addPlugin(\DebugKit\Plugin::class);
}

Usage

The plugin adds new panel to DebugKit Toolbar. You can see all your halts in that panel.

To halt simple use function:

halt($variable);

Inside halt you can see line number, file and content of halted variable.

For instance:

// inside PagesController.php
public function display(...$path) {
    halt($path);
    // rest of the code
}

And then halt shows:

Array
(
    [line] => 43
    [file] => /Users/malekim/Projects/halttest/src/Controller/PagesController.php
    [var] => Array
        (
            [0] => home
        )

)

Halt can be used to any type of variable and any sort of data.

It is important to note that halt() does not terminate script execution, so you can use any nuber of halt() during request. So it is helpful solution if you need to debug complicated things.