/Debug

Simple PHP Debug Class

Primary LanguagePHP

Debug - Smart PHP Debug Class

Debug is a smart class for debugging in php. The outputs are sent to the browser or written in own files.

Features

  • Shows a lot of information about variables, scalar types and arrays as valid PHP code that can be used for testing
  • Backtrace info (calling function / method / file with line numbers)
  • Time (absolute and relative)
  • Memory requirements
  • Shows preview images for resources of the type gd
  • Output to all web browsers without plugins
  • Logging to a custom file
  • Independent (Linux,Window, PHP from V5.6 up to V7.x)

How to use it

Easy, just download and include the class file and and make outputs wherever you want.

Simple example 1

require PATH_TO_CLASS.'class.debug.php';

$street = "Avenue des Champs-Élysées";
$array = [
  "country" => "France",
  "city" => "Paris",
  "street" => $street,
];
  
debug::write('examples', $street, $array);

Output

[18.12.2018 19:54:41,569](342k/362k) Debug::write "debugtest1.php Line 12
0string(8) ASCII"examples"
1string(27) UTF-8"Avenue des Champs-Élysées"
2array(3)array (
   'country' => "France"
   'city' => "Paris",
   'street' => "Avenue des Champs-Élysées",
)

Documentation

http://jspit.de/tools/classdoc.php?class=debug

Demo and Test

http://jspit.de/check/phpcheck.class.debug.php