Download the PHP package andreabsferrazza/phoog without Composer
On this page you can find all versions of the php package andreabsferrazza/phoog. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download andreabsferrazza/phoog
More information about andreabsferrazza/phoog
Files in andreabsferrazza/phoog
Package phoog
Short Description Phoog is a lightweight PHP library offering ultra-short debugging functions for quick variable inspection. Designed for speed and zero dependencies.
License MIT
Informations about the package phoog
Phoog – Minimal PHP Deb(oo)ugging Toolkit
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
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.
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
Example:
vip($var); - var info pre
Wraps VET between pre tags and returns it.
evi($var); - echo var info pre
The main function to print variables in HTML. Example:
result:
evid($var); - evi and die
Dies after echoing VIP. Example:
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.
Example:
Prints the query with newlines.
espd($str); - esp and die
Expects a String. Dies after echoing ESP. Example:
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
evc($var); - echo var CLI
The main function to print variables in CLI
evcd($var); - evc and die
Dies after evc($var); Example:
Will print the array before it is sorted. Result:
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
⚠️ 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.