As developers, we already know that using the right debugging tools can really make it easier to track bugs or improve the co
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
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
- You can use Kint in any PHP code from Tiki, for example:
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 :
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