Dump5
v2.0.1
PHP var_dump的漂亮版本。此类显示有关包含其类型和价值的一种或多种表达式的结构化信息。
查看dump7 for php 7+
您可以将最新版本作为独立下载,或者您可以使用作曲家
composer require ghostff/dump5 "require" : {
"ghostff/dump5" : " ^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 */
public $ big_object = null ;
} class FooBar
{
private $ inherited_int = 123 ;
private $ inherited_array = array ( ' string ' );
}
class Bar extends FooBar
{
private $ inherited_float = 0.22 ;
private $ inherited_bool = true ;
}
class Foo extends Bar
{
private $ string = ' string ' ;
protected $ int = 10 ;
public $ array = array (
' foo ' => ' bar '
);
protected static $ bool = false ;
}
$ string = ' Foobar ' ;
$ array = 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 , array (
' foo ' => ' bar ' ,
' bar ' => ' foo ' ,
array (
' foo ' => ' foobar ' ,
' bar_foo ' ,
2 => ' foo ' ,
' foo ' => array (
' barbar ' => 55 ,
' foofoo ' => false ,
' foobar ' => null ,
)
)
), $ resource );
new Dump ( 1 == ' 1 ' , 1 === ' 1 ' );更换预定义的颜色:
# set ( $ name , [ $cgi_color , $cli_color ] ) ;
Dump:: set ( ' boolean ' , array ( ' bb02ff ' , ' purple ' ));CGI输出:

CLI POSIX输出:

使用cmder等命令行工具的Windows用户可以使用Dump::d方法:
Dump:: d ( new Foo , $ string , $ array , $ int , $ double , $ null , $ bool , array (
' foo ' => ' bar ' ,
' bar ' => ' foo ' ,
array (
' foo ' => ' foobar ' ,
' bar_foo ' ,
2 => ' foo ' ,
' foo ' => array (
' barbar ' => 55 ,
' foofoo ' => false ,
' foobar ' => null ,
)
)
));CLI Windows输出:
