DebugKit for CakePHP

Published on 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]

37 comments baked

  • Could be handy: DebugKit for CakePHP | CakePHP Tips

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

  • Abhimanyu Grover

    Sounds cool.

  • Henrik

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

  • Henrik

    Keep me posted option

  • cakebaker

    @Abhimanyu, Henrik: Thanks for your comments!

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

  • Henrik

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

  • leo

    @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

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

  • nate

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

  • Henrik

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

  • Mandy

    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

    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

    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

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

  • cakebaker

    @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

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

  • Kit de débogage pratique - Pierre MARTIN

    […] 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

    This sounds great, kudos to mark again……

  • Abhimanyu Grover

    @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

    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

    @Abhimanyu: Good luck :)

  • mark story

    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

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

  • Abhimanyu Grover

    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

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

  • Abhimanyu Grover

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

  • DQ

    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

    @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

    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

    @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

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

  • DebugKit для CakePHP | Bunyan.Ru

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

  • Отладка проектов на CakePHP с использованием DebugKit - Программируем на CakePHP

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

  • sunil

    I have used debug toolkit and it shows the menu bar in right side of my screen. But I don`t understand how to check it`s working or not. please guide me. Thanks

  • cakebaker

    @sunil: If you get the menu bar it is probably working. Just visit the different tabs and have a look at what data are shown. For example, click on the “Request” tab and then you should see the name of your controller among many other data.

    Does this answer your question?

  • samir

    it does not work with Themes

  • cakebaker

    @samir: I don’t know whether it is supposed to work with themes, probably best to ask in the CakePHP irc channel or the Google Group.

Bake a comment




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

© daniel hofstetter. Licensed under a Creative Commons License