SimpleReflector for PHP

This is an easy-to-use reflection class for exposing an object's identity so problems can be debugged quickly.

It does correct null/true/false/empty string detection. A string just gets output directly, whereas objects will have their class interfaces exposed. Everything dumped to screen is correctly escaped for HTML output so the rest of the page doesn't break.

The following information is displayed for objects:

Download

Download SimpleReflector 1.0, view the source or fork it on github.

This software is released under the FreeBSD License (revised). (You can use it for free on your personal and commercial projects.)

Installation

Simply include the class and make calls to it. If you are using the PHP Autoloader then you won't even have to include it.

Example Usage

<?php
// echo info to screen (most common case)
SimpleReflector::jam($object);
// returns info as a string
$str SimpleReflector::jam($objecttrue);
// echo info to screen with a custom title instead of "SimpleReflector"
SimpleReflector::jam($objectfalse'crazy object');

Suggestion

For quicker use, consider adding a short function to your applications:
<?php
function jam() {
    
$args func_get_args();
    
call_user_func_array(array('SimpleReflector''jam'), $args);
}
Then instead of typing `SimpleReflector::jam(...)` you can just type `jam(...)`.