PHPackages                             pieceofcake2/debug\_kit - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Debugging &amp; Profiling](/categories/debugging)
4. /
5. pieceofcake2/debug\_kit

ActiveCakephp-plugin[Debugging &amp; Profiling](/categories/debugging)

pieceofcake2/debug\_kit
=======================

CakePHP 2 Debug Kit

v2.2.11(10mo ago)02.9k↑234.4%1MITPHPPHP &gt;=8.0CI passing

Since Oct 5Pushed 10mo agoCompare

[ Source](https://github.com/pieceofcake2/debug_kit)[ Packagist](https://packagist.org/packages/pieceofcake2/debug_kit)[ RSS](/packages/pieceofcake2-debug-kit/feed)WikiDiscussions 2.x Synced 2w ago

READMEChangelogDependencies (7)Versions (3)Used By (1)

CakePHP 2 DebugKit
==================

[](#cakephp-2-debugkit)

[![GitHub License](https://camo.githubusercontent.com/b8a2ff32828e3b54827ca40d4326d9008adcd51967824804ae1b1dd748ad8943/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f70696563656f6663616b65322f64656275675f6b69743f6c6162656c3d4c6963656e7365)](LICENSE)[![Packagist Version](https://camo.githubusercontent.com/a7d99299709ddfa2e9f09d6e6e9c6cb3967fa12d4f1ba8a2ed3a24f015949a1d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f70696563656f6663616b65322f64656275675f6b69743f6c6162656c3d5061636b6167697374)](https://packagist.org/packages/pieceofcake2/debug_kit)[![PHP](https://camo.githubusercontent.com/30eda54eee71739a043de494aa84677e543bbac6218987c36f3d8e082bdef5a5/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646570656e64656e63792d762f70696563656f6663616b65322f64656275675f6b69742f7068703f6c6f676f3d706870266c6f676f436f6c6f723d253233464646464646266c6162656c3d504850266c6162656c436f6c6f723d25323337373742423426636f6c6f723d253233464646464646)](https://camo.githubusercontent.com/30eda54eee71739a043de494aa84677e543bbac6218987c36f3d8e082bdef5a5/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646570656e64656e63792d762f70696563656f6663616b65322f64656275675f6b69742f7068703f6c6f676f3d706870266c6f676f436f6c6f723d253233464646464646266c6162656c3d504850266c6162656c436f6c6f723d25323337373742423426636f6c6f723d253233464646464646)[![CakePHP](https://camo.githubusercontent.com/431ef6a81e108d865db390c2443569f33b24e31b5cd1ad11f16284a6f0753763/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646570656e64656e63792d762f70696563656f6663616b65322f64656275675f6b69742f70696563656f6663616b65322f63616b657068703f6c6f676f3d63616b65706870266c6f676f436f6c6f723d253233464646464646266c6162656c3d43616b65504850266c6162656c436f6c6f723d25323344333343343326636f6c6f723d253233464646464646)](https://camo.githubusercontent.com/431ef6a81e108d865db390c2443569f33b24e31b5cd1ad11f16284a6f0753763/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646570656e64656e63792d762f70696563656f6663616b65322f64656275675f6b69742f70696563656f6663616b65322f63616b657068703f6c6f676f3d63616b65706870266c6f676f436f6c6f723d253233464646464646266c6162656c3d43616b65504850266c6162656c436f6c6f723d25323344333343343326636f6c6f723d253233464646464646)[![CI](https://camo.githubusercontent.com/343d777a7e3af400a4480871ac9cc7bb83f5eaa5a87dbca77cf489ab759ab2ed/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f70696563656f6663616b65322f64656275675f6b69742f43492e796d6c3f6c6162656c3d4349)](https://github.com/pieceofcake2/debug_kit/actions/workflows/CI.yml)[![Codecov](https://camo.githubusercontent.com/97835152e4fcd1cf83ddcf872d5d290f96626d7a436c49a9ebbdb63ee295c016/68747470733a2f2f696d672e736869656c64732e696f2f636f6465636f762f632f67682f70696563656f6663616b65322f64656275675f6b69743f6c6162656c3d436f766572616765)](https://codecov.io/gh/pieceofcake2/debug_kit)

**This is forked for CakePHP2.**

DebugKit provides a debugging toolbar and enhanced debugging tools for CakePHP applications.

Requirements
------------

[](#requirements)

The master branch has the following requirements:

- CakePHP 2.11+
- PHP 8.0+

Installation
------------

[](#installation)

Install the plugin with [Composer](https://getcomposer.org/) from the directory, where your project's `composer.json` is located:

```
composer require --dev pieceofcake2/debug_kit

```

> Consider using "--dev", if you only want to include DebugKit for your development environment.

Because this plugin has the type `cakephp-plugin` set in it's own `composer.json`, composer knows to install it inside your `/Plugin` directory, rather than in the usual vendors file. It is recommended that you add `/Plugin/DebugKit` to your .gitignore file. (Why? [read this](http://getcomposer.org/doc/faqs/should-i-commit-the-dependencies-in-my-vendor-directory.md).)

### Enable plugin

[](#enable-plugin)

- In 2.x, you [need to enable the plugin](http://book.cakephp.org/2.0/en/plugins/how-to-install-plugins.html#enable-the-plugin)in your `app/Config/bootstrap.php` file. If you are already using `CakePlugin::loadAll();`, then the following is not necessary.:

```
    CakePlugin::load('DebugKit');
```

- Include the toolbar component in your `app/Controller/AppController.php`:

```
class AppController extends Controller {
         public $components = ['DebugKit.Toolbar'];
}
```

- Set `Configure::write('debug', 1);` in `app/Config/core.php`.
- Make sure to remove the 'sql\_dump' element from your layout (usually `app/View/Layouts/default.ctp`), if you want to experience the awesome that is the DebugKit SQL log.

Reporting Issues
----------------

[](#reporting-issues)

If you have a problem with DebugKit please open an issue on [GitHub](https://github.com/pieceofcake2/debug_kit/issues).

Contributing
------------

[](#contributing)

If you'd like to contribute to DebugKit, check out the [roadmap](https://github.com/cakephp/debug_kit/wiki/roadmap) for any planned features. You can [fork](https://help.github.com/articles/fork-a-repo)the project, add features, and send [pull requests](https://help.github.com/articles/using-pull-requests) or open [issues](https://github.com/cakephp/debug_kit/issues).

Versions
--------

[](#versions)

DebugKit has several releases, each compatible with different releases of CakePHP. Use the appropriate version by downloading a tag, or checking out the correct branch.

- `2.2.x` are compatible with CakePHP 2.2.0 and greater. It is a necessary upgrade for people using CakePHP 2.4 as the naming conventions around loggers changed in that release.

Documentation
=============

[](#documentation)

Toolbar Panels
--------------

[](#toolbar-panels)

The DebugKit Toolbar is comprised of several panels, which are shown by clicking the CakePHP icon in the upper right-hand corner of your browser after DebugKit has been installed and loaded. Each panel is comprised of a panel class and view element. Typically, a panel handles the collection and display of a single type of information such as Logs or Request information. You can choose to panels from the toolbar or add your own custom panels.

### Built-in Panels

[](#built-in-panels)

There are several built-in panels, they are:

- **History** Allows access to previous request information, useful when debugging actions with redirects.
- **Request** Displays information about the current request, GET, POST, Cake Parameters, Current Route information and Cookies if the `CookieComponent`is in you controller's components.
- **Session** Display the information currently in the Session.
- **Timer** Display any timers that were set during the request see `DebugKitDebugger` for more information. Also displays memory use at component callbacks as well as peak memory used.
- **Sql Logs** Displays sql logs for each database connection.
- **Log** Display any entries made to the log files this request.
- **Variables** Display View variables set in controller.
- **Environment** Display environment variables related to PHP + CakePHP.

Configuration
-------------

[](#configuration)

The toolbar has a few configuration settings. Settings are passed in the component declaration like normal component configuration.

```
public $components = array(
    'DebugKit.Toolbar' => array(/* array of settings */)
);
```

### Configuring Panels

[](#configuring-panels)

You can customize the toolbar to show your custom panels or hide any built-in panel when adding it toolbar to your components.

```
public $components = array('DebugKit.Toolbar' => array(
    'panels' => array('MyCustom', 'timer'=>false)
    )
);
```

Would display your custom panel and all built-in panels except the 'Timer' panel.

#### Controlling Panels

[](#controlling-panels)

Using the panels key you can specify which panels you want to load, as well as the order in which you want the panels loaded.

```
public $components = array(
        'DebugKit.Toolbar' => array('panels' => array('MyCustom', 'timer' => false))
);
```

Would add your custom panel `MyCustomPanel` to the toolbar and exclude the default `Timer` panel. In addition to choosing which panels you want, you can pass options into the `__construct` of the panels. For example the built-in `History` panel uses the `history` key to set the number of historical requests to track.

```
public $components = array(
        'DebugKit.Toolbar' => array('history' => 10)
);
```

Would load the `History` panel and set its history level to 10. The `panels` key is not passed to the Panel constructor.

#### forceEnable

[](#forceenable)

The `forceEnable` setting is new in DebugKit 1.1. It allows you to force the toolbar to display regardless of the value of `Configure::read('debug');`. This is useful when profiling an application with debug kit as you can enable the toolbar even when running the application in production mode.

#### autoRun

[](#autorun)

autoRun is a new configuration setting for DebugKit 1.2. It allows you to control whether or not the toolbar is displayed automatically or whether you would like to use a query string parameter to enable it. Set this configuration key to false to use query string parameter toggling of the toolbar.

```
public $components = array(
    'DebugKit.Toolbar' => array('autoRun' => false)
);
```

When visiting a page you can add `?debug=true` to the url and the toolbar will be visible. Otherwise it will stay hidden and not execute.

Developing Your Own Panels
--------------------------

[](#developing-your-own-panels)

You can create your own custom panels for DebugKit to help in debugging your applications.

### Panel Classes

[](#panel-classes)

Panel Classes simply need to be placed in`Panel` directory inside a `Lib` path. The filename should match the classname, so the class `MyCustomPanel` would be expected to have a filename of `app/Lib/Panel/MyCustomPanel.php`.

```
App::uses('DebugPanel', 'DebugKit.Lib');

/**
 * My Custom Panel
 */
class MyCustomPanel extends DebugPanel {
        ...
}
```

See also the example `Test/test_app/Plugin/DebugkitTestPlugin/Lib/Panel/PluginTestPanel.php`.

Notice that custom panels are required to subclass the `DebugPanel` class. Panels can define the `css` and `javascript` properties to include additional CSS or javascript on the page. Both properties should be an array.

```
class MyCustomPanel extends DebugPanel {
        public $javascript = array(
                '/my_plugin/js/custom_panel.js'
        );
}
```

### Callbacks

[](#callbacks)

Panel objects have 2 callbacks, that allow them to hook into and introspect on the current request.

```
startup(Controller $controller)
```

Each panel's `startup()` method is called during component `startup()` process. `$controller` is a reference to the current controller object.

```
beforeRender(Controller $controller)
```

Much like `startup()` `beforeRender()` is called during the Component beforeRender() process. Again `$controller` is a reference to the current controller. Normally at this point you could do additional introspection on the controller. The return of a panels `beforeRender()` is automatically passed to the View by the Toolbar Component. Therefore, under normal use you do not need to explicitly set variables to the controller.

#### Example of beforeRender Callback

[](#example-of-beforerender-callback)

```
/**
 * beforeRender callback - grabs request params
 *
 * @return array
 */
 public function beforeRender(Controller $controller) {
     return $controller->params;
 }
```

This would return cake's internal params array. The return of a panel's `beforeRender()` is available in you Panel element as `$content`

### Panel Elements

[](#panel-elements)

Each Panel is expected to have a view element that renders the content from the panel. The element name must be the underscored inflection of the class name. For example `SessionPanel` has an element named `session_panel.ctp`, and sqllogPanel has an element named `sqllog_panel.ctp`. These elements should be located in the root of your `View/Elements` directory.

#### Custom Titles and Elements

[](#custom-titles-and-elements)

Panels should pick up their title and element name by convention. However, if you need to choose a custom element name or title, there are properties to allow that configuration.

- `$title` - Set a custom title for use in the toolbar. This title will be used as the panels button.
- `$elementName` - Set a custom element name to be used to render the panel.

### Panels as Cake Plugins

[](#panels-as-cake-plugins)

Panels provided by [Cake Plugins](http://book.cakephp.org/2.0/en/plugins.html) work almost entirely the same as other plugins, with one minor difference: You must set `public $plugin` to be the name of the plugin directory, so that the panel's Elements can be located at render time.

```
class MyCustomPanel extends DebugPanel {
    public $plugin = 'MyPlugin';
        ...
}
```

To use a plugin panel, use the common CakePHP dot notation for plugins.

```
public $components = array('DebugKit.Toolbar' => array(
    'panels' => array('MyPlugin.MyCustom')
));
```

The above would load all the default panels as well as the custom panel from `MyPlugin`.

Cache Engine
------------

[](#cache-engine)

By default, DebugKit uses File as the engine for internal caching, but if you want to use another cache engine you can customize it by simply adding a cache key inside the components config array.

```
public $components = array('DebugKit.Toolbar' => array(
        'cache' => array('engine' => 'Memcache', 'servers' => array('127.0.0.1:11211'))
        )
);
```

You can use any cache engine supported by CakePHP, the same way you set in both core.php and bootstrap.php files with the Cache::config() method.

###  Health Score

36

—

LowBetter than 79% of packages

Maintenance55

Moderate activity, may be stable

Popularity21

Limited adoption so far

Community21

Small or concentrated contributor base

Maturity42

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 73.7% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~7 days

Total

3

Last Release

302d ago

PHP version history (2 changes)v2.2.10PHP ^8.0

v2.2.11PHP &gt;=8.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/578548?v=4)[TSURU](/maintainers/ttsuru)[@ttsuru](https://github.com/ttsuru)

---

Top Contributors

[![markstory](https://avatars.githubusercontent.com/u/24086?v=4)](https://github.com/markstory "markstory (609 commits)")[![ttsuru](https://avatars.githubusercontent.com/u/578548?v=4)](https://github.com/ttsuru "ttsuru (37 commits)")[![lorenzo](https://avatars.githubusercontent.com/u/37621?v=4)](https://github.com/lorenzo "lorenzo (16 commits)")[![renan](https://avatars.githubusercontent.com/u/28046?v=4)](https://github.com/renan "renan (13 commits)")[![rafb43](https://avatars.githubusercontent.com/u/11786?v=4)](https://github.com/rafb43 "rafb43 (12 commits)")[![ceeram](https://avatars.githubusercontent.com/u/111448?v=4)](https://github.com/ceeram "ceeram (11 commits)")[![ravage84](https://avatars.githubusercontent.com/u/625761?v=4)](https://github.com/ravage84 "ravage84 (11 commits)")[![jperras](https://avatars.githubusercontent.com/u/20675?v=4)](https://github.com/jperras "jperras (10 commits)")[![wa0x6e](https://avatars.githubusercontent.com/u/495709?v=4)](https://github.com/wa0x6e "wa0x6e (10 commits)")[![joelmoss](https://avatars.githubusercontent.com/u/4614?v=4)](https://github.com/joelmoss "joelmoss (8 commits)")[![h4ck3rm1k3](https://avatars.githubusercontent.com/u/34903?v=4)](https://github.com/h4ck3rm1k3 "h4ck3rm1k3 (7 commits)")[![gemal](https://avatars.githubusercontent.com/u/69105?v=4)](https://github.com/gemal "gemal (7 commits)")[![tersmitten](https://avatars.githubusercontent.com/u/3392962?v=4)](https://github.com/tersmitten "tersmitten (7 commits)")[![josegonzalez](https://avatars.githubusercontent.com/u/65675?v=4)](https://github.com/josegonzalez "josegonzalez (7 commits)")[![ichikaway](https://avatars.githubusercontent.com/u/91244?v=4)](https://github.com/ichikaway "ichikaway (6 commits)")[![scottharwell](https://avatars.githubusercontent.com/u/805434?v=4)](https://github.com/scottharwell "scottharwell (5 commits)")[![mcurry](https://avatars.githubusercontent.com/u/29715?v=4)](https://github.com/mcurry "mcurry (5 commits)")[![bcrowe](https://avatars.githubusercontent.com/u/752603?v=4)](https://github.com/bcrowe "bcrowe (5 commits)")[![tenkoma](https://avatars.githubusercontent.com/u/16202?v=4)](https://github.com/tenkoma "tenkoma (5 commits)")[![evilbloodydemon](https://avatars.githubusercontent.com/u/39753?v=4)](https://github.com/evilbloodydemon "evilbloodydemon (4 commits)")

---

Tags

debugcakephpkitcakephp2

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/pieceofcake2-debug-kit/health.svg)

```
[![Health](https://phpackages.com/badges/pieceofcake2-debug-kit/health.svg)](https://phpackages.com/packages/pieceofcake2-debug-kit)
```

###  Alternatives

[johnbillion/query-monitor

Query Monitor is the developer tools panel for WordPress and WooCommerce.

1.8k545.8k25](/packages/johnbillion-query-monitor)[cakephp/debug_kit

CakePHP Debug Kit

86214.9M183](/packages/cakephp-debug-kit)[helsingborg-stad/municipio

A bootstrap theme for creating municipality sites.

4028.6k10](/packages/helsingborg-stad-municipio)[renan/cakephp-xhprof

Plugin that quickly enables XHProf profiling for your CakePHP application.

2138.7k](/packages/renan-cakephp-xhprof)[pressbooks/pressbooks-book

This theme is named after Canadian media theorist Marshall McLuhan, who coined the phrase “the medium is the message.” It is designed for academic writing and is also suitable for fiction. Headings are set in Cormorant Garamond, and body type is set in Lora.

226.7k](/packages/pressbooks-pressbooks-book)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
