As part of my GitHub Projects series, I present to you: PHP-Debugging
What is this?
This library provides functions that are useful during development. They perform a variety of tasks, but centre around flushing data to the buffer in raw-form to resolve some issue.
Why did I develop it?
I developed this library to have quick shortcuts to common used logic/functions.
More than anything, it was to save me some time during the development/debugging process, and have all these functions (which are primarily only used during development) decoupled from any framework-level logic.
What's included?
This project includes a series of functions (currently 8) which, for the most part, print statements to the output buffer in order to assess a point in code. These specific functions are:
backtrace
Prints a backtrace up until that point in code in a friendly wayel
Logs the passed in argument to the error log. Acts as a shortcut/alias oferror_log
elx
Does as above, but then exits the script immediatelyex
Exits the script immediately with a status of0
(alias of the exit function)pr
Acts as an alias for theprint_r
function, however wraps the output inpre
tags to make it more readableprx
Acts as an alias of thepr
function, followed by theex
functionvd
Acts as an alias of thevar_dump
function (accepts multiple parameters). Outputs the variable value and typevdx
Acts as an alias of thevd
function, followed by theex
function
How do I use it?
These functions are primarily used during development. An exception to this is
the el
function which I may use during recoverable errors.
Simply use it during your flow, functionally, checking out the function documentation for appropriate parameter types and return values.
Why did I abstract it out?
I thought about building these functions directly into the TurltePHP framework, but wanted to have them available for really small projects, applications or scripts. While not all of these need to be used exclusively under the label of debugging, I thought they would fall suitably well there.
There we go.
Up next, PHP-SecureSessions.