Debugbar for Slim3


does anybody know of a debugbar for Slim 3 which is readily installable via composer?

Thanks for any pointers

I’ve been using Tracy and it works quite well. I’m also using it as Slim’s error handler and wrote a little middleware for it to dump form data into the debugbar. I’ve been planning to write some docs about using it with Slim, but just haven’t gotten around to it yet. Let me know if you need any help with it.

1 Like

Thanks a lot for that link, Tracy looks nice, I’ll give it a try.

OK, Tracy basically seems quite nice. 2 questions though:

  1. It doesn’t seem to catch my DB calls though (the github page shows and example of how it can do that). Any ideas why this might not be the case. BTW, I’m using Eloquent ORM.

  2. Any chance you could share your middleware, even if it’s not 100% done yet? I’m having a project here with some relatively inexperienced developers and any debug info we can capture on the fly would be of help.

Thanks a lot

  1. The example they show is using data from the framework itself. To do that with Eloquent, you would likely need to add some sort of event handler to listen for Eloquent’s queries, then log them. I know there is an Illuminate Component event listener/dispatcher, so perhaps that might work to catch them. You would then probably want to follow the Tracy directions to add a panel to the debugbar. I was going to do this at one time, but settled to just turn on the database log itself.

  2. Sure, have a look at this gist.

Thanks a lot on both fronts; your help is highly appreciated. If I come up with something useful, I’ll be sure to share it.

Happy to help! :slight_smile:

You might have noticed, but Tracy comes with a nice error handler too. You can unset Slim’s to take full advantage of it. So wherever you are enabling Tracy…

1 Like

If someone likes PHP Debug Bar more than Tracy, I’m making a Slim Starter Kit using it. It also uses Eloquent. Link to the repo:

Sorry for the lack of documentation. I was using it just for personal projects but now I’m posting it because it could help you. I’ll work on make it more understandable in the future.

Thanks, I’ll be sure to take a look.

Hello everybody
Maybe someone will be interesting integration Tracy with Eloquent in Slim 3
if desired, you can not use a table and display only raw data
in this table not add bindings but for now i not interest it

as make gist link will be added

ok, Slim 3 / Eloquent / Tracy gist

1 Like

A gist for this would be highly appreciated. Thanks in advance.

Hello everybody
another a very simple solution using Twig_Profiler_Dumper_Html
I have not found a decent Twig svg logo so just use text label in panel

if interested, see gist


Nice, thank you! :slight_smile:

added bindings, gist updated

1 Like

@1f7, any thoughts of putting this out as a package?

I have some (IMHO cool) additions for this and have a package pretty much ready. Give me a few days to get organized and I can put it all together (unless someone else wants to do this).

1 Like

Nice, I’d happy to help and have some possible addings/configs as well.

Hi @tflight, no problem but for which skeleton?
package need config, config need skeleton.
i use skeleton with dir structure based on symfony.
and begin build cmf with this.

ok, wait you and support too if it is not conflict with my structure

It should be fairly generic to work with most any Skeleton or Slim project. Taking a quick look, TracyDBMiddleware just needs an instance of \Illuminate\Database\Capsule\Manager and Twig_Profiler_Profile. After pulling in the package with composer, all the user would need to do is add a TracyDBMiddleware definition to their container passing it the Capsule Manager and Twig Profiler. Then they would add the middleware to their app, route, or however they want. It could work with nearly any project with Twig and Eloquent. Could even make it optional to use just the Twig panel, just the Eloquent panel, or both.

We’re essentially providing a middleware, which expects its config from the container. Not too different from how this Auth middleware from @tuupola gets setup and configured, independent of any specific skeleton.

in general, you’re right