{"id":22466688,"url":"https://github.com/knowthecode/debug-toolkit","last_synced_at":"2025-08-02T07:31:08.114Z","repository":{"id":43342308,"uuid":"174237629","full_name":"KnowTheCode/debug-toolkit","owner":"KnowTheCode","description":"Code debug made easier and more enjoyable - WordPress Plugin","archived":false,"fork":false,"pushed_at":"2024-01-02T06:19:52.000Z","size":15737,"stargazers_count":23,"open_issues_count":7,"forks_count":9,"subscribers_count":4,"default_branch":"develop","last_synced_at":"2025-04-08T15:46:01.385Z","etag":null,"topics":["wordpress-plugin"],"latest_commit_sha":null,"homepage":"https://wordpress.org/plugins/debug-toolkit/","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/KnowTheCode.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-03-06T23:38:58.000Z","updated_at":"2024-01-04T05:44:35.000Z","dependencies_parsed_at":"2023-02-12T22:16:09.440Z","dependency_job_id":null,"html_url":"https://github.com/KnowTheCode/debug-toolkit","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/KnowTheCode/debug-toolkit","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KnowTheCode%2Fdebug-toolkit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KnowTheCode%2Fdebug-toolkit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KnowTheCode%2Fdebug-toolkit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KnowTheCode%2Fdebug-toolkit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/KnowTheCode","download_url":"https://codeload.github.com/KnowTheCode/debug-toolkit/tar.gz/refs/heads/develop","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KnowTheCode%2Fdebug-toolkit/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268348611,"owners_count":24236297,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-02T02:00:12.353Z","response_time":74,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["wordpress-plugin"],"created_at":"2024-12-06T10:13:14.689Z","updated_at":"2025-08-02T07:31:07.052Z","avatar_url":"https://github.com/KnowTheCode.png","language":"PHP","readme":"# Developer Debug Toolkit\n\nCode debug made easier and more enjoyable.  This WordPress plugin includes a suite of developer essential tools to debug your code.\n\nHere's what you get:\n\n* Better PHP error interface from ([Whoops](http://filp.github.io/whoops/))\n* Better variable inspection - no need to use `var_dump`, `print_r`, or X-debug\n    * [VarDumper from Symfony](https://symfony.com/doc/current/components/var_dumper.html)\n    * [Kint - a modern and powerful PHP debugging helper](https://kint-php.github.io/kint/)\n* An interactive way to back trace the program's execution order\n\n## Requirements\n\n* PHP 5.6 and up\n\n## Table of Contents\n\n* [Better Variable Inspection](#better-variable-inspection)\n    * [Functions](#variable-dumper-functions)\n* [Backtracing the Call Stack](#backtracing-the-call-stack)\n    * [Functions](#trace-functions)\n* [Better PHP Error Interface](#better-php-error-interface)\n* [Admin Bar Indicator](#admin-bar-indicator)\n\n[Watch an introductory video on Vimeo](https://vimeo.com/322351688)\n\n## Better Variable Inspection\n\nThough X-debug is powerful, it can be difficult to set up and run.  For that reason, it's common to dump or print out the variable to browser.  But the built-in display for the PHP `var_dump` and `print_r` is basic.\n\nThis plugin includes both two very popular variable dumper tools:\n\n* [VarDumper from Symfony](https://symfony.com/doc/current/components/var_dumper.html)\n* [Kint - a modern and powerful PHP debugging helper](https://kint-php.github.io/kint/)\n\nVarDumper provides a simple container that displays where you place it.\n\nKint gathers all the data and displayed it at the bottom of the screen as a fixed position container.  It also provides a call stack, which can be handy, and tracing functionality if you need it.\n\n### Which one should you use?\n\nIt depends.\n\n1. You want to simply display the contents of a variable: Use VarDumper's functions, i.e. `vdump()`, `vd()`, `vdd()`, or `vddd()`.\n2. You want the call stack in addition to the variable:  Use Kint's functions: `d()`, `dd()`, or `ddd()`.\n\n### Variable Inspection Functions\n\n| Task      | VarDumper | Kint     |\n| :---        | :---    | :---  |\n| Dumps the given variable(s) | `vdump( mixed $var );` | `dump( mixed $var [ , mixed $var2, ...] );` |\n| Dumps and dies   | `vdump_and_die( mixed $var );` | `dump_and_die( mixed $var [ , mixed $var2, ...] );` |\n\n\u003e**TIP**\n\u003eUse the full functions instead of the aliases.  Why?  It's easier to search your code to find where you put each of them. Searching for `d(`, for example, can be frustrating.  But searching for `dump(`, that will be a more targeted search.\n\n**Alias (shorthand) Functions**\n\n| Task      | VarDumper | Kint     |\n| :---        | :---    | :---  |\n| Dumps plain text | na | `s( mixed $var [ , mixed $var2, ...] );` |\n| Dumps the given variable(s) | `vd( mixed $var );` | `d( mixed $var [ , mixed $var2, ...] );` |\n| Dumps and dies   | `vdd( mixed $var );` | `dd( mixed $var [ , mixed $var2, ...] );` |\n| Dumps and dies   | `vddd( mixed $var );` | `ddd( mixed $var [ , mixed $var2, ...] );` |\n\n#### Examples\n\nUsing the VarDumper functions:\n\n```php\nadd_action( 'loop_start', function() {\n\tglobal $post;\n\n\t$array = [\n\t\t'ID'    =\u003e get_the_ID(),\n\t\t'title' =\u003e get_the_title(),\n\t];\n\n\tvdump( $array );\n\tvdump_and_die( $post );\n} );\n```\n\nIt renders like this:\n\n![screenshot 1](screenshot-1.png)\n\nUsing the Kints functions:\n\n```php\nadd_action( 'loop_start', function() {\n\tglobal $post;\n\n\t$array = [\n\t\t'ID'    =\u003e get_the_ID(),\n\t\t'title' =\u003e get_the_title(),\n\t];\n\n\tdump( $array );\n\tdump_and_die( $post );\n} );\n```\n\nIt renders like this:\n\n![screenshot 2](screenshot-2.png)\n\nNotice the subtle differences between them:\n\n* VarDumper's functions provide a very simple highlighter container.\n* Kint is shown at the bottom of the screen.  Notice that it provides more information.\n\nHere's the example code for `s()`:\n\n```php\nadd_action( 'loop_start', function() {\n\t$array = [\n\t\t'ID'    =\u003e get_the_ID(),\n\t\t'title' =\u003e get_the_title(),\n\t];\n\n\ts( $array );\n} );\n```\n\nIt renders as:\n\n![screenshot of s( $array )](docs/s.png)\n\n## Better PHP Error Interface from Whoops\n\nThe built-in PHP error container is basic and not as helpful as it could be.  On top of that, it's rather ugly. Wouldn't you agree?\n\nThe Whoops package gives you a cool interface that is helpful, interactive, and quite nice to look at.\n\nConsider the error this code would produce:\n\n```php\nadd_action( 'loop_start', function() {\n\tdoes_not_exist();\n} );\n```\n\n![Whoops error interface](docs/whoops.gif)\n\nYou can learn more about Whoops by visiting [http://filp.github.io/whoops/](http://filp.github.io/whoops/).\n\n## Backtracing the Call Stack\n\nWhen debugging, there are times when you need to see the order in which functions were called that lead to a certain point in the program.  PHP offers a backtrace that traces back the execution order from the point when the function is invoked.\n\nTo make backtracing easier, this plugin provides you with a `trace()` function and combines it with the variable dumper functions.\n\n### Trace Functions\n\n| Task      | VarDumper | Kint     |\n| :---        | :---    | :---  |\n| Dumps backtrace | na | `trace();` |\n| Dumps backtrace + given variable(s) | `trace_vdump( mixed $var );` | `trace_dump( mixed $var [ , mixed $var2, ...] );` |\n| Dumps backtrace + variable(s) and then dies   | `trace_vdump_and_die()( mixed $var );` | `trace_dump_and_die()( mixed $var [ , mixed $var2, ...] );` |\n| Alias for trace and dump   | `trace_vdump_and_die()( mixed $var );` | `traced()( mixed $var [ , mixed $var2, ...] );` |\n| Alias for trace and dump and die   | `tracevdd()( mixed $var );` | `tracedd()( mixed $var [ , mixed $var2, ...] );` |\n| Alternative alias for trace and dump and die   | `tracevddd()( mixed $var );` | `traceddd()( mixed $var [ , mixed $var2, ...] );` |\n\nThe `trace();` function will render the call stack that lead up to where you invoke the function. For example, if you added this code at the end of your theme's `functions.php` file:\n\n```php\nadd_action( 'loop_start', function() {\n\ttrace();\n} );\n```\n\nthe `trace()` renders as:\n\n![trace() gif](docs/trace.gif)\n\nNotice that the container is interactive.  Click on each call stack item and its associated code appears.  This is a powerful debugging tool to discover the execution order through your code.\n\n## Admin Bar Indicator\n\nAs this tool is meant for development mode only, you need a way to know the plugin is enabled.  No problem. A \"DEBUG MODE\" indicator is added to the WordPress admin bar.\n\n![Admin Bar indicator](docs/admin-bar-indicator.gif)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fknowthecode%2Fdebug-toolkit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fknowthecode%2Fdebug-toolkit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fknowthecode%2Fdebug-toolkit/lists"}