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(窗口):
