steevanb/php-backtrace

优秀的debug_backtrace()输出,包含调用和代码预览

2.1.0 2021-05-16 16:56 UTC

This package is auto-updated.

Last update: 2024-09-17 00:26:04 UTC


README

version php Lines Total Downloads Scrutinizer

php-backtrace

展示与debug_backtrace()相同效果的输出,包含调用者,代码预览等。

可在HTML中使用,或与symfony/console一起使用。

变更日志

安装

composer require --dev steevanb/php-backtrace ^2.1

配置

// configure how file paths will be shown
// true : remove path prefix, based on DumpBacktrace.php path (assume it is in vendor/ dir)
// false : do not remove anything in file paths
// string : remove this prefix
\DumpBacktrace::setRemovePathPrefix($remove);

以HTML格式输出

// get backtrace dump as array
\DebugBacktraceHtml::getBacktraces();
// get backtrace dump as HTML
\DebugBacktraceHtml::getDump();
// write getDump() HTML with echo
\DebugBacktraceHtml::dump();
// write getDump() HTML with echo, and exit
\DebugBacktraceHtml::eDump();

HTML backtrace

在symfony/console应用程序中输出

// Write dump
\DebugBacktraceConsole::dump();
// Write dump and exit
\DebugBacktraceConsole::eDump();

Console backtrace