Skip to content

Debug tools like: varExport* functions, timer, server dump, debug handler, SQL Beautifier, etc.

License

Notifications You must be signed in to change notification settings

jgauthi/component_debug

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Component Debug

Debug tools like: varExport* functions, timer, server dump, debug handler, SQL Beautifier, etc.

  • VarExport* functions is a var_export() extended, with <pre></pre> and multiples arguments $var exported. You can use several streams for output debug var (html comment, debug file, values returned).
  • VarExport*_wp functions is a wordpress version of precedents functions. These debug functions is display on site or admin footer.
  • Class Timer to evaluate time script and specific portion code.
  • Debug Handler is a script who display in the footer some debug information on the current page (dump values _GET, _POST..., files used, time script and memory, phpinfo, etc).

Prerequisite

  • PHP 8.2 (v2.1), old version: 7.4 (v2), 5.6 (v1.2+), 5.4+ (v1.1), 4 (v1.0)

Install

Edit your composer.json (launch composer update after edit):

{
  "repositories": [
    { "type": "git", "url": "[email protected]:jgauthi/component_debug.git" }
  ],
  "require-dev": {
    "jgauthi/component_debug": "2.*"
  }
}

Define the constant for dump exported variable on the folder (require write permissions):

define('DEBUG_EXPORT_PATH', sys_get_temp_dir());

// Or, set manually
define('DEBUG_EXPORT_PATH', __DIR__.'/tmp');

For use VarExport*_wp functions (wordpress), you can include the VarExportWordpress.php file on wp-config.php or theme init:

require_once __DIR__.'/vendor/autoload.php';

if (defined('WP_DEBUG') && WP_DEBUG) {
    include_once __DIR__.'/vendor/jgauthi/component_debug/src/VarExportWordpress.php';
}

For use the VarDumperServer (optional): composer require --dev symfony/var-dumper, and launch the command on your terminal: ./vendor/bin/var-dump-server.

Documentation

You can look at folder example.