定制 andreabsferrazza/phoog 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

andreabsferrazza/phoog

Composer 安装命令:

composer require andreabsferrazza/phoog

包简介

Phoog is a lightweight PHP library offering ultra-short debugging functions for quick variable inspection. Designed for speed and zero dependencies.

README 文档

README

Phoog is a lightweight PHP library offering short-named debugging functions for quick variable inspection. Designed for speed, and zero dependencies — ideal for rapid prototyping, legacy debugging, or everyday dev workflows.

Features

  • Compact functions like evi(), evid(), evc(), vip(), etc.
  • Output optimized for both HTML and CLI

Installation

composer require andreabsferrazza/phoog

Optional: Global Shortcuts

If you prefer to use the debug functions (evc(), evi(), etc.) without importing them in every file, you can include the helper once in your project bootstrap. To enable them, define PHOOG_ENABLE_HELPERS = true before loading Composer’s autoload.

// Before autoload
define("PHOOG_ENABLE_HELPERS", true);
require_once __DIR__ . '/vendor/autoload.php';

Usage

⚠️ Phoog provides tools for quick diagnostics and prototyping. It is not designed for secure or high-availability production use. Global function exposure and file logging should be used with discretion.

vet($var); - var export true

return var_export($var,true);

Example:

try{
    ...
}catch(Exception $e){
    ...
    echo "Var x = ".vet($x);
}

vip($var); - var info pre

Wraps VET between pre tags and returns it.

evi($var); - echo var info pre

echo vip($var); The main function to print variables in HTML. Example:

$x = 0;
$y = array( 0,1,2,3 );
evi($x);
evi($y);

result:

0
array (
  0 => 0,
  1 => 1,
  2 => 2,
  3 => 3,
)

evid($var); - evi and die

Dies after echoing VIP. Example:

foreach($array as $k=>$v){
    ...
    if($condition) evid($v);
    ...
}

Prints the variable $v and dies if $condition == true

sip($str); - string in pre

Expects a String. Returns EVI with some HTML formatting. Usually for printing out queries or text with \n.

esp($str); - echo string in pre

Expects a String. echo sip($var); Example:

$query = "SELECT * 
            FROM whatever";
esp($query);

Prints the query with newlines.

espd($str); - esp and die

Expects a String. Dies after echoing ESP. Example:

$query = "SELECT * 
            FROM whatever";
espd($query);
echo $smth;

Prints the query with newlines and then dies, so $smth won't be echoed.

vit($var); - var info td

Wraps VET between td tags and returns it. This is for debugging in table tags, which often is a bit hefty.

evt($var); - echo var info td

echo vit($var);

evc($var); - echo var CLI

echo vet($var).PHP_EOL; The main function to print variables in CLI

evcd($var); - evc and die

Dies after evc($var); Example:

$array = array(0,1,2,3,4);
evcd($array);
arsort($array);

Will print the array before it is sorted. Result:

sm@smw:~/$ php your_program.php
array (
  0 => 0,
  1 => 1,
  2 => 2,
  3 => 3,
)
sm@smw:~/$

dof($var, $filename = "debug_log.json", $incremental = true) - debug on file

Writes the contents of a variable to a JSON file. Useful when outputting to screen isn’t possible (e.g. in reports, cron jobs, or background processes).

$incremental: If true, appends each call as a new entry (default). If false, overwrites the file on each call.

Each log entry is saved as a timestamped object inside a debug array, making the file easy to parse or view in tools like Firefox.

Example

$data = ['user' => 'Monkey', 'role' => 'admin'];
dof($data); // Writes to debug_log.json

// Custom filename and overwrite
dof($_POST, '/tmp/my-debug.json', false);

⚠️ Caution when using dof()

dof() writes to disk — make sure the target path ($filename) is writable and not publicly accessible via web, especially if it contains sensitive data. Use dof() only in development environments, not in production. Avoid dumping user data to predictable paths like /tmp/debug_log.json without proper permissions. If $incremental is true, the log file may grow indefinitely — monitor its size in long-running systems.

andreabsferrazza/phoog 适用场景与选型建议

andreabsferrazza/phoog 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 9 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 06 月 30 日, 在 PHP 生态内属于活跃度较高的组件。

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

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

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-06-30