Mecha already has a built-in function called test()
to perform simple data inspections returned by PHP expressions. This extension provides a more useful and complete inspection function by using the global kint()
function.
Usage
The way you use it is exactly the same as you would use the test()
function, so it will be easier for you to refactor your existing code if you want to use this extension in the long run. It is a good practice to always call this function within a non-production mode conditional statement, so that this function will not be executed when you are already in production mode:
if (defined('TEST') && TEST) {
if (function_exists('kint')) {
kint($_COOKIE, $_ENV, $_FILES, $_GET, $_POST, $_REQUEST, $_SERVER);
} else {
test($_COOKIE, $_ENV, $_FILES, $_GET, $_POST, $_REQUEST, $_SERVER);
}
exit;
}
I really recommend you to install this extension if you want to develop Panel features on your own. By using this extension, the Panel data inspection results will look very neat and tidy:
Hook::set('_', function ($_) {
kint($_, $_GET, $_POST, $_SESSION, $_SERVER);
exit;
}, 1000); // Execute as late as possible…
0 Comments
No comments yet.