pandaman内置了debugbar,使用注解可以快速方便的在任何位置注册你的debug信息
// 注册debug信息收集器
#[AsDebugDataCollector]
class ConfigDataCollector extends RequestDataCollector
{
public function getName()
{
return 'config';
}
public function collect()
{
foreach (\config()->get() as $key => $value) {
$data[$key] = $this->getDataFormatter()->formatVar($value);
}
return $data ?? [];
}
public function getWidgets()
{
return array(
"config" => array(
"icon" => "gears",
"widget" => "PhpDebugBar.Widgets.VariableListWidget",
"map" => "config",
"default" => "{}"
)
);
}
}