Debuggin in Mezzio

What is the var_dump() equivalent in Mezzio. Or how do log messages in messeges in Mezzio for debug purposes.

Hey @sanjivsharmalv ,

for logging you can practically use laminas/laminas-log. I guess there is no equivalent vor var_dump(). As you might know from laminas-mvc there is a developer toolbar for mezzio, too. Or just use XDebug.

Can you give a practical use case for better understanding for what you 'll need a var_dump() equivalent?

There are already great libraries; no need to reinvent the wheel. For example:

1 Like

See also in the documentation of Mezzio:

And in the issue tracker:

Thanks! Just that var_dump() easiesrt debugging tool to use. Now I have plan to use Monolog logger to dump the messages to a file.

Just as a suggestion. I would add a switch so that either A) You dump it to the browser via tracy (I have working code along with how to add laminas db profiling to Tracy if you need it.) if you are in dev mode or B) you log it to a file with monolog in production (I also have code for adding monolog with a few extra bells and whistles) in mezzio. Just thought I would mention it.