thiagomeloo/terminal-debug

在终端中调试和打印变量

1.0.0 2023-03-03 00:10 UTC

This package is auto-updated.

Last update: 2024-09-10 17:25:35 UTC


README

Example

Terminal Debug的诞生目的是通过直接将值打印到终端来调试它们,从而让开发者大部分时间都能专注于他们的代码。

该工具仍处于早期阶段,所以欢迎您提出所有建议。

要求

  • PHP ^8.0
    • extension socket 激活

安装

  • 在终端执行

        composer require thiagomeloo/terminal-debug --dev
    

用法

  • 使用以下命令启动服务器以监听调试消息

        php vendor/bin/terminal-debug -s
    
  • 或者您可以通过命令行运行客户端

        php vendor/bin/terminal-debug -c "terminal debug example"
    

示例

  • 要将调试消息发送到服务器,您有以下几种选择

    • 打印字符串消息

      <?php
          tDebug("Terminal Debug");
    • 打印数组

      <?php
          tDebug([1,2,3, 4]);
    • 打印对象

      <?php
          $obj = (object)[
              "example" => "terminal debug"
          ];
          tDebug($obj);

打印

  • 启动服务器

    startServer

  • 接收调试

    exampleDebug

  • 命令行助手

    comandHelpers