PHP_Debug : A PHP open source debug library

FAQ

What are the different debug type ?

  • PHP_DEBUGLINE_ANY : All available types (for search mode)
  • PHP_DEBUGLINE_STD : Standart debug
  • PHP_DEBUGLINE_QUERY : Query debug
  • PHP_DEBUGLINE_REL : Database related debug
  • PHP_DEBUGLINE_ENV : Environment debug ($GLOBALS...)
  • PHP_DEBUGLINE_APPERROR : Custom application error
  • PHP_DEBUGLINE_CREDITS : Credits information
  • PHP_DEBUGLINE_SEARCH : Search mode in debug
  • PHP_DEBUGLINE_DUMP : Dump any kind of variable
  • PHP_DEBUGLINE_PROCESSPERF : Performance analysys
  • PHP_DEBUGLINE_TEMPLATES : Included templates of the calling script
  • PHP_DEBUGLINE_PAGEACTION : Store main page action
  • PHP_DEBUGLINE_SQLPARSE : SQL Parse error
  • PHP_DEBUGLINE_WATCH : A variable to watch
  • PHP_DEBUGLINE_PHPERROR : A debug generated by the custom error handler

But in fact, these types are automatically used with the different public functions of PHP_Debug


What are the different options available ?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
 
<?php
$options = array(
    'DEBUG_restrict_access'      => false,
    'DEBUG_allow_url_access'     => true,
    'DEBUG_url_key'              => 'key',
    'DEBUG_url_pass'             => 'nounou',
    'DEBUG_enable_watch'         => false,
    'DEBUG_replace_errorhandler' => true,
    'DEBUG_lang'                 => 'FR',
    'HTML_TABLE_view_source_script_name' => 'PHP_Debug_ViewSource.php'        
);
 
$Dbg = new Debug($options);
 
$allowedip = array( 
    '127.0.0.1'
);
 
$Dbg->restrictAcess($allowedip);  
?>

  • DEBUG_restrict_access

    Allow to restrict access to some IP only. This is done by calling the restrict access function, with an array containing IP.

  • DEBUG_allow_url_access

    Allow to activate the display of the debug with a key and a password in the URL of the executed script. (DEBUG_url_key, DEBUG_url_pass)
    Ex : 'http://scripts.php?key=nounou'

  • DEBUG_enable_watch

    Allow to use the variable watcher (see index.php)

  • DEBUG_replace_errorhandler

    Allow to use the PHP_Debug error handler instead of the native PHP error handler. In some cas (old PHP4 script) you may have lots of errors, it is possible to desactivate it

  • DEBUG_lang

    Not used for now


What are the different renderer options available ?

You can find all default options of each renderer in the HTML_xxx_Config.php files.

I don't understand the way stopTimer() function works can you explain me ?

Well in fact it is easy : (check the examples) First you may add a debug info, of any tipe, then you simply have to call the stopTimer function.

1
2
3
4
5
6
7
8
9
10
11
 
<?php
$Dbg->add("PERF TEST : 10000 iterations");
 
$y = 0;
for ($index = 0; $index < 10000; $index++) 
{
    $y = $y + $index;
}
$Dbg->stopTimer();
?>

What are the different public functions available ?

Please check 'sources/index.php', there is an example with all the public functions available in PHP_Debug.

Please........

Ahhhhhhh !!!!!!

  • new Debug($array()) : PHP_Debug constructor
  • restrictAcess($array) : Restrict debug to some IP
  • add($mixed, $title (optional)) : Add the variable 'mixed' with the title 'string'
  • dump(var, 'Foo') : Dump the content of the variable 'var' with the title 'foo'
  • dumpVar(var, 'Foo') : Same as dump but can be called staticaly
  • setAction($action) : Set the action of the scrip with $action (string)
  • watch('watchedVariable') : Watch the variable called 'watchedVariable
  • stopTimer() : Stop the timer for the last debug information added
  • addDebugFirst($string) : Same as Add() but add the information in 1st position
  • query($query) : Add a query wich sql scrip is contained in $query
  • getRequiredFiles() : Return the list of required files in the script
  • getOutput() : Get the display as a string
  • getDebugInfos() : Get the debug infos as an array
  • addSetting(), addSettings(), add debugs of "settings" type

The debug is ugly it seems that there are no stylesheet associated with it ?

You can modify/extend the HTML_xxx_Config files and/or the related css files that are used by PHP_Debug (check css dir)

SQL Technologies
01-11-2008 21:09:53
» Design taken and adaptated from PHP::Pear website
» Show source of this file
» Click here to register the newsletter
Last updated: 20 Apr 2007 by COil
Hosting by OVH
Close