承接 perchten/neat_html 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

perchten/neat_html

Composer 安装命令:

composer require perchten/neat_html

包简介

Pretty-print PHP objects and arrays in html, json etc.

README 文档

README

Prettier html printing of php objects and arrays

Installation

Via Composer

Neat_html is available on Packagist (perchten/neat_html) and as such is installable via Composer.

Add the following to your composer.json

{
	"require": {s
    	"perchten/neat_html": "1.*"
    }
}
Direct include

Clone or download from GitHub and include directly in your code:

require_once "path/to/neat_html.php"

Usage

Simple neat_html
neat_html($somevar)

Will print $somevar into html as a <pre>-wrapped block formatted like JSON.

Return, Don't Print
$output = neat_html($somevar,true)

As with neat_html($somevar) except that the output is returned, captured in the $output variable and not printed.

Die Immediately After Debug Print
neat_html($somevar,"die")

Outputs the formatted $somevar and then dies.

Output as Html Comment
neat_html($somevar,"comment")

Outputs the formatted code in comment form. comments start <!--neat_html for easy searching.

Do not wrap in <pre> tags
neat_html($somevar,"nopre")

Outputs the formatted code without wrapping it in <pre> tags. Useful for console printing.

Print Included Files
neat_html($somefileref,'include)

Takes $somefileref as a file reference and includes that file's contents. Obviously, if the included file uses undefined variables then it will fail.

Also, the file reference must be absolute. For convenience a truepath function is included to get the real path. (PHP's realpath() function is a bit buggy, so best not use that. see http://stackoverflow.com/questions/4049856/replace-phps-realpath). e.g.

neat_html(truepath($somefileref),'include')
Output in JSON (Handy For Ajax)
neat_html($somevar,'json')

Returns the object in json notation. Handy when debugging over ajax that expects a json response.

Output in PHP (Handy For Purists ;))
neat_html($somevar,'php')

Returns the object in php notation. This then uses the var_export function instead of print_r. So the returned values here can even be interpreted directly as php variables.

Multiple Arguments

You can also collect multiple arguments together in a second argument array as follows:

neat_html($somevar,array("include","comment","return");

Or as a comma or space separated list:

neat_html($somevar,"include, comment, return");

And, as of v1.2 you can even use dynamic arguments:

neat_html($somevar,"include","comment","return");
var_dump
neat_html($somevar,'dump');

This will run all data manipulation on $somevar (including if it is a file include), and then var_dump the result in addition to outputting in any other specified formatting.

Defaults

You can set defaults at a global level if you find yourself repeating the same optional arguments all the time.

Neat_Html::setDefault($option);

Neat_Html::getDefaults();

Neat_Html::setDefaults($optionsArray);

Neat_Html::removeDefault($option);	
Enabling/Disabling

neat_html statements will run by default, but you can control this by switching the functionality on and off globally, and querying the current state.

Neat_Html::setOn() // switches this module on globally

Neat_Html::setOff() // switches this module off globally

Neat_Html::isOn() // return true if module is on, otherwise false

License

Neat_html is licensed under the MIT License - see the LICENSE file for details

perchten/neat_html 适用场景与选型建议

perchten/neat_html 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 2.03k 次下载、GitHub Stars 达 4, 最近一次更新时间为 2014 年 05 月 13 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「php」 「json」 「debug」 「console」 「html」 「comments」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 perchten/neat_html 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 perchten/neat_html 我们能提供哪些服务?
定制开发 / 二次开发

基于 perchten/neat_html 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 2.03k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 5
  • 点击次数: 18
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 4
  • Watchers: 2
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2014-05-13