DebugKit for CakePHP

Published on October 30, 2008 and tagged with cakephp  plugin

In CakePHP’s github account you can find a plugin called “DebugKit”, written by Mark Story. It provides some useful information while developing an application, and adds the following toolbar to your application:

If you hover the mouse over one of the titles, it shows you the respective information, e.g. the content of the session. Pretty simple.

All you have to do is to place DebugKit in the plugins folder of your application and to add the following to your AppController (resp. the controller(s) where you want to use it):

public $components = array('DebugKit.toolbar');

You can get DebugKit either via Git with

git clone git://github.com/cakephp/debug_kit.git

or you can download it as zip/tar from github. There is also some documentation available.

Happy baking!

PS: Some days ago Garrett Woodworth (aka gwoo) talked about CakePHP and Beyond at the CakePHP conference in Tokyo. It’s not a very technical talk, but maybe it is still of interest for some of you. [via CakePHP Google Group]

33 comments baked

  • Could be handy: DebugKit for CakePHP | CakePHP Tips October 30, 2008 at 13:06

    [...] just found in my RSS feeds. It describes a very handy CakePHP plugin. DebugKit shows a toolbar in your applica… Share and [...]

  • Abhimanyu Grover October 30, 2008 at 13:25

    Sounds cool.

  • Henrik October 30, 2008 at 15:44

    looking like cakephp are checking out symfony and django ;) obviously taken from symfony

  • Henrik October 30, 2008 at 16:27

    Keep me posted option

  • cakebaker October 30, 2008 at 17:32

    @Abhimanyu, Henrik: Thanks for your comments!

    @Henrik: Good things get copied ;-) I don’t understand your second comment…

  • Henrik October 30, 2008 at 17:36

    @cakebaker forgot to check off the notify me on new comments box

  • leo October 30, 2008 at 17:59

    @cakebaker: I think Henrik just forgot to check the “Notify me of folloup…” checkbox… ;)

    The DebugKit looks great - a really useful addition to CakePHP! Thanks to Mark Story for this - but I think this will be “officially” announced in the next days…

  • Henrik October 30, 2008 at 18:04

    Still they should give credit to the people they got the inspiration from

  • nate October 30, 2008 at 18:43

    Henrik: Heh… displaying debug info in a console is not exactly a novel concept. ;-)

  • Henrik October 30, 2008 at 18:45

    @nate! No but it is pretty darn close to the one symfony has and the one Django adopted from symfony so come on!

  • Mandy October 30, 2008 at 18:48

    I couldn’t use it much as it relies heavily on the cake.generic.css file. I think it should be a good value addition to cake provided it uses it’s own css and let other sites use their custom css.

  • Jonah October 30, 2008 at 21:03

    Nice, good job mark_story.

    I’ll be testing this out after school. Maybe it should be moved to the core and be turned ON automatically when in development mode? I mean I’m always putting pr($session->read()) in my beforeFilter method when debugging the auth component, for example, so I think this would be helpful to pretty much everybody.

    Also as a side note, the dev team should not hesitate to adopt ideas from other frameworks if they are good ideas. There is nothing wrong with that.

  • Abhimanyu Grover October 31, 2008 at 07:26

    Daniel, I wanted to ask if you need to do anything apart from adding it in components array? I’m unable to see the toolbar

  • Frank October 31, 2008 at 14:00

    Somebody give that man another day! Take Christmas day or something Mark you deserve it.

  • cakebaker October 31, 2008 at 18:17

    @all: Thanks for your comments!

    @Mandy: Hm, at least here it works fine without a cake.generic.css file. And it already comes with its own css file (see plugins/debug_kit/vendors/css)

    @Jonah: Yeah, it would probably be a good addition to the core. We will see what the cake team will do with it in the future…

    @Abhimanyu: No, that was all I had to do. Did you name the respective folder “debug_kit” in app/plugins? And if you look at the HTML source of your page, does it contain some DebugKit elements?

  • links for 2008-10-31 « Richard@Home November 01, 2008 at 07:01

    [...] DebugKit for CakePHP - cakebaker Sounds useful. (tags: cakephp component debugging) Posted by Richard@Home Filed in Uncategorized [...]

  • Kit de débogage pratique - Pierre MARTIN November 02, 2008 at 07:47

    [...] CakePHP tout chaud, sorti mi-Octobre. L’information est parvenue à mes oreilles grâce à un article sur Cakebaker … et il est vrai qu’il n’y a pas plus simple d’installation [...]

  • Brett Wilton November 03, 2008 at 01:30

    This sounds great, kudos to mark again……

  • Abhimanyu Grover November 03, 2008 at 14:23

    @cakebaker: Yes I had setup it correct, not sure why its not even elements being included. I think I’ll have to dig source now.

    Thanks anyway.

  • Abhimanyu Grover November 03, 2008 at 14:24

    Sorry for the typo in previous comment.

    @cakebaker: Yes I had setup it correct, not sure why not even elements are included. I think I’ll have to dig source now.

    Thanks anyway.

  • cakebaker November 03, 2008 at 18:28

    @Abhimanyu: Good luck :)

  • mark story November 04, 2008 at 17:54

    Beat me to it Daniel ;)

    Henrik: Yes it was inspired by the symfony and django tools. But I’m sure if one looked hard enough you could find further prior art. And its to the credit of the symfony and django project for coming up with a good idea.

    As for how to use it, you should just include the component. There are additional configurations that can be set, and those are somewhat covered in the wiki pages as well as in a future article that I will have to quickly write, before someone else writes it ;)

    I’m glad to hear that people are enjoying it, and thanks should go out to joel perras and joel moss for helping out getting the javascript library compatibility expanded.

  • cakebaker November 06, 2008 at 17:12

    @mark: Thanks for your comment! I’m looking forward to your future article :)

  • Abhimanyu Grover November 08, 2008 at 19:40

    I finally had some time today, to find out the issue - I’m sure other people are facing this as well.

    In Toolbar::startup() the line where this plugins sets:
    $controller->view = ‘DebugKit.Debug’;
    before checking for a statement here:

    if (!isset($controller->params['url']['ext']) || (isset($controller->param['url']['ext']) && $controller->params['url']['ext'] == ‘html’)) {
    $controller->view = ‘DebugKit.Debug’;
    } else {
    //use firephp view class.
    }

    I see, it never enters the first part. Anyone knows the reason?

    I had to manually set the view to use ‘DebugKit.Debug’ before I could get it working.

  • cakebaker November 10, 2008 at 18:23

    @Abhimanyu: Hm, do you use Router::parseExtensions()?

  • Abhimanyu Grover November 11, 2008 at 06:56

    Yes, I had it for RSS feeds in this project.

  • DQ November 11, 2008 at 15:00

    Application’s “CakePHP DebugKit” css is very bad….. for me and my site.

    The headlines go white and the lists also go white… Nice. Setting the css color: #000; for all the elements helps a bit, but still it’s a mess. Also the #debug-kit-toolbar { needs z-index. Please someone, give the project some css help.

    There were no place to suggest any approvements (no forum or anything), so that was also bad for debugkit project.

  • rafaelbandeira3 November 12, 2008 at 12:30

    @DQ : Remember that it’s hosted on github, so ou can easily fork the project, apply your changes and ask them to be pushed to the original project, or just have it customized to fit your ideas.
    I’ve forked it and, by now, improved it’s CSS a little. You can find me there as rafaelbandeira3.

    Debug Kit really kick some bad times on every-day debugs. Is a must have on development mode. I only think that the dependency of a view class makes it very intrusive, although there are almost no one who uses extended views, I do it a lot and then I have to apply some customizations to the plugin.
    Maybe if it join the core, the view functionalities could be applied to a helper, wich would have some special use during the rendering process just as CacheHelper does.

  • rafaelbandeira3 November 13, 2008 at 02:41

    A helper based version is on development and is already in github, on the original repo in “helper-toolbar” branch, and on AD7six’ fork. Haven’t tested nor tried, but looks nice.

  • cakebaker November 13, 2008 at 18:52

    @Abhimanyu: Did you check the value of $this->params['url']['ext']?

    @DQ: As Rafael already mentioned, you can fork the project.

    Yes, a forum (or something similar) is missing. On the other hand I think people probably don’t mind if you post debugkit-related things to the cakephp google group.

    @Rafael: Same here, I also noticed that debugkit doesn’t like it if you use a custom view class…

  • Pretty, Painless and Productive debug with DebugKit « Something on Everything November 23, 2008 at 08:58

    [...] 23, 2008 CakePHP DebugKit has been released some time ago now, you [...]

  • DebugKit для CakePHP | Bunyan.Ru December 04, 2008 at 15:16

    [...] Оригинал [...]

  • Отладка проектов на CakePHP с использованием DebugKit - Программируем на CakePHP December 08, 2008 at 22:25

    [...] в двух публикациях нашел ссылки на замечательный плагин к [...]

Bake a comment




(for code please use <code>...</code> [no escaping necessary])

© daniel hofstetter. Licensed under a Creative Commons License