projector22 / php-debuggin-tool
多种PHP调试工具
1.1.1
2023-03-13 08:31 UTC
Requires
- php: >=8.0
This package is auto-updated.
Last update: 2024-09-13 11:27:20 UTC
README
PHP调试工具
自动加载说明
Debug
类包含了一组静态属性,这些属性链接到各种工具类。为了使它按预期工作,您需要首先调用Debug::__constructStatic()
,或者更理想的是,从您的自动加载函数中调用它。例如。
function autoload( string $class ) { /** * EXAMPLE */ $path = realpath( __DIR__ . '/examplePath/' ); $require_path = str_replace( '\\', '/', $path. $class ); require_once $require_path . '.php'; /** * THIS IS THE IMPORTANT BIT. * * Check method `__constructStatic` exists and call it if so. */ if ( method_exists( $class, '__constructStatic' ) ) { $class::__constructStatic(); } }
工具
显示
用法如下
Debug::$display->data( 'Example Data' ); Debug::$display->table( ['a' => 'b', 'c' => 'd'] ); Debug::$display->page_data();
计时
用法如下
Debug::$timer->start(); // Some code Debug::$timer->timestamp( 'label' ); // Some code Debug::$timer->timestamp( 'another label' ); // Some code Debug::$timer->end( true );
Lorium
用法如下
Debug::$lorium->generate( 2 );
命令
用法如下
Debug::$cmd->show_output( 'ls' );
Js
用法如下
Debug::$js->detect_keystroke();
日志
用法如下
Debug::$log->to_file( 'Some Data' ); Debug::$log->to_file( ['key' => 'Some Data'] ); Debug::$log->to_file( 'SELECT * FROM table_name', 'sql.log' );