Debugging utility to speed up Tiki developers' process
As developers, we already know that using the right debugging tools can really make it easier to track bugs or improve the codebase. See also GlitchTip.
Why do we need Debugging?
- Reports an error immediately so that we can detect the errors in it’s earlier stage.
- It assists the developer in reducing useless and distracting information.
Kint - a modern and powerful PHP debugging helper
What is it?
Kint for PHP is a tool designed to present your debugging data in the absolutely best way possible.
In other words, think of Kint as a modern tool to help you track your code with more flexibility.
We are already familiar with some PHP debugging functions like var_dump(), debug_backtrace(), get_defined_vars(), etc. But what if you got a magic toolbox that will wrap up all the essentials interface to debug your code?
In brief, Kint is a de facto addition to your development toolbox.
How to use Kint to Debug in Tiki Development?
Don't worry about long installation, importing, or namespacing... The developer's community at Tiki decided to bundle Kint With newly tiki releases so it will make it easy to call all Kint functions at glance. https://gitlab.com/tikiwiki/tiki/-/commit/feb553ff5cba282c5c62d811ae58a15120923867
❗ Remember!
Before using Kint utility functions you have to access your shell and enable the developer mode.
Once you have access to your console interface, please run the following command from the root folder:
php console.php dev:configure
If you want to know more about the command please run
php console.php help dev:configure
What's next?
- You can use Kint in any PHP code from Tiki, for example:
Usage of Kint::trace in any PHP file
Copy to clipboard
Kint::trace(); // Dump a backtrace
and you can get informations like:
- You can run Smarty Kint Modifier within the smarty template files: you sometimes run a case where you want to dump your variables from tpl files, with the "d" modifier available in Tiki ( alias for Kint::dump()) you can backtrace your variables' metadata :
the syntax is :
a given tpl file code snippet
Copy to clipboard
{$varName|d}
example of output:
As you can see we have even got a bunch of informations about the variable
The kint full documentation can be read at Kint Docs
{DIV(class="jumbotron lead")}Debugging utility to speed up Tiki developers' process{DIV}
As developers, we already know that using the right debugging tools can really make it easier to track bugs or improve the co<x>debase. See also ((GlitchTip)).
!!Why do we need Debugging?
* Reports an error immediately so that we can detect the errors in it’s earlier stage.
* It assists the developer in reducing useless and distracting information.
-+Kint - a modern and powerful PHP debugging helper+-
!!! What is it?
Kint for PHP is a tool designed to present your debugging data in the absolutely best way possible.
In other words, think of Kint as a modern tool to help you track your code with more flexibility.
We are already familiar with some PHP debugging functions like [https://www.php.net/manual/fr/function.var-dump.php|var_dump()], [https://www.php.net/manual/fr/function.debug-backtrace.php|debug_backtrace()], [https://www.php.net/manual/fr/function.get-defined-vars.php|get_defined_vars()], etc. But what if you got a magic toolbox that will wrap up all the essentials interface to debug your code?
In brief, Kint is a de facto addition to your development toolbox.
!!! ~~#F00: How to use Kint to Debug in Tiki Development? ~~
Don't worry about long installation, importing, or namespacing... The developer's community at Tiki decided to bundle Kint With newly tiki releases so it will make it easy to call all Kint functions at glance. [https://gitlab.com/tikiwiki/tiki/-/commit/feb553ff5cba282c5c62d811ae58a15120923867]
(:exclaim:) __Remember! __
Before using Kint utility functions you have to access your shell and enable the developer mode.
Once you have access to your console interface, please run the following command from the root folder:
-+php console.php dev:configure+-
If you want to know more about the command please run
-+php console.php help dev:configure+-
!!! What's next?
* You can use Kint in any PHP code from Tiki, for example:
{CODE(caption="Usage of Kint::trace in any PHP file" colors="php" theme="default")}Kint::trace(); // Dump a backtrace{CODE}
and you can get informations like:
{img fileId="1803"}
* You can run Smarty Kint Modifier within the smarty template files: you sometimes run a case where you want to dump your variables from tpl files, with the "d" modifier available in Tiki ( alias for Kint::dump()) you can backtrace your variables' metadata :
the syntax is :
{CODE(caption="a given tpl file code snippet" colors="smarty" theme="elegant")}{$varName|d}{CODE}
example of output:
{img fileId="1802"}
As you can see we have even got a bunch of informations about the variable
The kint full documentation can be read at [https://kint-php.github.io/kint/|Kint Docs]