Dump7
v2.0.2
PHP var_dump的漂亮版本。此类显示有关包含其类型和价值的一种或多种表达式的结构化信息。
查看dump5 5 php 5+
您可以将最新版本作为独立下载,或者您可以使用作曲家
composer require ghostff/dump7 "require" : {
"ghostff/dump7" : " ^1.0 "
}您可以使用DOC块标志简单隐藏或显示一些对象属性:
@dumpignore-inheritance | 隐藏了继承的类属性。 |
@dumpignore-inherited-class | 隐藏从继承属性中隐藏类名。 |
@dumpignore-private | 显示除私人属性以外的所有属性。 |
@dumpignore-protected | 显示除受保护的属性以外的所有属性。 |
@dumpignore-public | 显示除公共属性以外的所有属性。 |
@dumpignore | 隐藏文档评论所属的属性。 |
/**
* @dumpignore-inheritance
* @dumpignore-inherited-class
* @dumpignore-private
* @dumpignore-public
* @dumpignore-public
*/
Class Foo extends Bar {
/** @dumpignore */
private ? BigObject $ foo = null ;
} class FooBar
{
private $ inherited_int = 123 ;
private $ inherited_array = [ ' string ' ];
}
class Bar extends FooBar
{
private $ inherited_float = 0.22 ;
private $ inherited_bool = 1 == ' 1 ' ;
}
class Foo extends Bar
{
private $ string = ' string ' ;
protected $ int = 10 ;
public $ array = [
' foo ' => ' bar '
];
protected static $ bool = false ;
}
$ string = ' Foobar ' ;
$ array = [ ' foo ' , ' bar ' ];
$ int = 327626 ;
$ double = 22.223 ;
$ null = null ;
$ bool = true ;
$ resource = fopen ( ' LICENSE ' , ' r ' );
$ m = microtime ( true );
new Dump ( new Foo , $ string , $ array , $ int , $ double , $ null , $ bool , [
' foo ' => ' bar ' ,
' bar ' => ' foo ' ,
[
' foo ' => ' foobar ' ,
' bar_foo ' ,
2 => ' foo ' ,
' foo ' => [
' barbar ' => 55 ,
' foofoo ' => false ,
' foobar ' => null ,
]
]
], $ resource );
new Dump ( 1 == ' 1 ' , 1 === ' 1 ' );
Dump:: safe (... $ args ); # running on terminal without color capabilities .更换预定义的颜色:
# set ($ name , [$ cgi_color , $ cli_color ]);
Dump:: set ( ' boolean ' , [ ' bb02ff ' , ' purple ' ]);默认情况下,当函数内部调用Dump时,呼叫线将设置为函数内部的new Dump而不是函数调用。使用setTraceOffset您可以设置每个呼叫线的偏移量。
function dump ()
{
Dump:: setTraceOffset ( 2 );
new Dump (... func_get_args ()); # Dont use this test. php ( line : 4 ) as call line
}
dump ( ' foo ' , 22 , ' bar ' , true ); // Use test.php(line:7) insteadCGI输出:

CLI(UNIX):

CLI(窗口):
