arcanisgk/boh-basic-ouput-handler

此包最新版本(v1.0.5)没有提供许可信息。

[BOH] 是一个非常简单的 PHP [输出处理器] 实现,它显示人类可读信息,而不是使用默认的 PHP 方法

v1.0.5 2021-02-27 06:12 UTC

This package is not auto-updated.

Last update: 2024-09-19 23:30:40 UTC


README

GitHub license State GitHub issues Minimum PHP version

缩写:[BOH].

名称:基本输出处理器。

依赖项:独立 / PHP v7.4。

什么是 [BOH]

[BOH] 是一个非常简单的 PHP [输出处理器] 实现,它显示人类可读信息,而不是使用默认的 PHP 选项

  • var_dump() - 显示变量的信息。
  • print_r() - 打印变量的可读信息。
  • debug_zval_dump() - 输出表示 zend 内部值的字符串。
  • var_export() - 打印或返回一个可解析变量的字符串表示形式。

这意味着所有传递的数据都根据所选参数展示给开发者。这也意味着显示的数据可以直接用作代码。每个值也生成注释,简要说明数据类型

为什么使用 [BOH]

开发者需要能够决定当数据需要检查时,他们的代码如何行为。原生 PHP 方法提供了一系列信息,这些信息对开发者不可重用,或者甚至可能需要更多的工作来为数据验证获取正确的输出。

这个库处理数据输出,已被证明非常有效。[BOH] 是一个独立实现,可用于任何项目,并且不需要第三方库或软件。

帮助改进 [BOH]

如果您想与该库的开发合作;您可以在: https://github.com/arcanisgk/BOH-Basic-Ouput-Handler/issues 中表达您的想法或报告与此相关的情况

[BOH] 配置

无需配置。

[BOH] 安装

composer require arcanisgk/boh-basic-ouput-handler
or 
composer require arcanisgk/boh-basic-ouput-handler --dev

[BOH] 使用

类实例

use \IcarosNet\BOHBasicOuputHandler as Output;
require __DIR__.'\..\vendor\autoload.php';
$output = new Output\Output_Handler();

自定义颜色方案

//you can define the theme to be used in the output in web or cli:
$output = new Output\Output_Handler('monokai'); //in the class Instance or
$output->Theme('monokai');                      //call the method Theme

方法选项

$output->output($example_array);            // send the variable and library would check the best output for you.
$output->output($example_array,'web');      // or send a second argument for enviroment 'web' or 'cli'.
$output->output($example_array,'web',true); // if you need retrive the string instead of output send true in thirt param.
$output->output($example_array,'cli');      // the library support output for CLI enviroment.
$output->output($example_array,'cli',true); // an cli can retrive strings.

示例输出

Image of Example Output

输出单元测试

版本 v1.1.0 的单元测试待定

贡献者

我要特别感谢来自 php.net、StackExchange 社区和 Reddit(/r/PHPhelp/) 的程序员们的帮助、合作和支持。

  • Mr_What4 (Reddit)
  • CyberJack77 (Reddit)
  • requinix (PHP.net)
  • patricio-moracho (SOes)
  • quevedo (SOes)
  • mauricio-contreras (SOes)
  • gbianchi (SOes)
  • Triby (SOes)
  • Marcos (SOes)
  • anythingg (SOes)
  • mdfst13 (CodeReview SE)
  • Sᴀᴍ Onᴇᴌᴀ (CodeReview SE)
  • mast (CodeReview SE)
  • der-kommissar (CodeReview SE)
  • peilonrayz (CodeReview SE)

在项目中以不可估量的方式支持我的人,大家好。