Is there a Pretty Print Stack Dump?

后端 未结 8 1880
半阙折子戏
半阙折子戏 2021-02-07 17:41

Let\'s face it, debug_backtrace() output is not very pretty. Did anyone code a wrapper?

And what\'s your favourite pretty var_dump() (which is

8条回答
  •  爱一瞬间的悲伤
    2021-02-07 18:12

    The Xdebug extension can print stacktraces with a configurable degree of verbosity.

    Xdebug stacktrace image

    It also offers some additional var_dump() features such as syntax coloring:

    Colored var_dump()

    Edit:

    Regarding the inclusion of Xdebug in a commercial project.

    The Xdebug license has only a few terms and seems pretty permissive.

    Xdebug is a C extension. As such re-distributing it or part of it in your project may be somewhat difficult. Depending on your requirements I see a few options:

    • Have your end user install Xdebug from a Linux distribution package or a DLL from the site
    • Distribute .dll and .so files for all supported platforms
    • Have your end user build the source code
    • Distribute a custom build of PHP

提交回复
热议问题